Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • bob.io.base bob.io.base
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Terraform modules
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • bobbob
  • bob.io.basebob.io.base
  • Issues
  • #7

What is the use of PyBobIo_FilenameConverter

Created by: siebenkopf

I have recently seen that there is a filename converter that converts a Python str into a PyBytesObject* (in py3) and into a PyStringObject* (in py2). https://github.com/bioidiap/bob.io.base/blob/master/bob/io/base/file.cpp#L70 Afterwards, the returned value is converted to char*, as here: https://github.com/bioidiap/bob.io.base/blob/master/bob/io/base/file.cpp#L119 where, once again, it has to be differentiated between py2 and py3.

However, I don't see, why we do not use the "s" variable indicator, which handles both str and unicode in py2: https://docs.python.org/2/c-api/arg.html and str (which is the same as unicode) in py3: https://docs.python.org/3.5/c-api/arg.html

char* filename = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &filename)) return -1;

So, do I miss something or is this converter simply useless?

Assignee
Assign to
Time tracking