This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author DavidMertz
Recipients BTaskaya, DahlitzFlorian, DavidMertz, dreamsorcerer, ethan.furman, gene_wood, hakancelik, python-dev
Date 2021-09-09.00:42:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1631148148.78.0.548733775292.issue40563@roundup.psfhosted.org>
In-reply-to
Content
I've made the few additional changes to those in this PR.  When I work out the issues, I'll make a new PR.  I took out an attempt with `path_t`.  However, here is why I think argument clinic (or something else?!) is actually intercepting the attempted call:

With my temporary debugging, I have this function in `Modules/_gdbmmodule.c`:

```c
[clinic start generated code]*/

static PyObject *
dbmopen_impl(PyObject *module, PyObject *filename, const char *flags,
             int mode)
/*[clinic end generated code: output=9527750f5df90764 input=812b7d74399ceb0e]*/
{
    PyObject_Print(filename, stdout, 0);
    printf(" from _gdbmmodule.c (XXX)\n");
    /* ... rest of function ...*/
```

And I have a very simplified test script:

```python
import _gdbm
import sys
from pathlib import Path

print(sys.version)
path = '/tmp/tmp.db'

db = _gdbm.open(path, 'c')
print("Opened with string path")
db.close()

db = _gdbm.open(Path(path), 'c')
print("Opened with path-like")
db.close()
```

The output of running this is:

```
3.11.0a0 (heads/[bpo-45133](https://bugs.python.org/issue45133)-dirty:0376feb030, Sep  8 2021, 00:39:39) [GCC 10.3.0]
'/tmp/tmp.db' from _gdbmmodule.c (XXX)
Opened with string path
Traceback (most recent call last):
  File "/home/dmertz/tmp/pathlike-dbm.py", line 12, in <module>
    db = _gdbm.open(Path(path), 'c')
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: open() argument 1 must be str, not PosixPath
```

So before I get to the first line of the _gdbm.open() function, the TypeError is already occurring when passed a PosixPath.
History
Date User Action Args
2021-09-09 00:42:28DavidMertzsetrecipients: + DavidMertz, ethan.furman, python-dev, gene_wood, DahlitzFlorian, BTaskaya, hakancelik, dreamsorcerer
2021-09-09 00:42:28DavidMertzsetmessageid: <1631148148.78.0.548733775292.issue40563@roundup.psfhosted.org>
2021-09-09 00:42:28DavidMertzlinkissue40563 messages
2021-09-09 00:42:28DavidMertzcreate