[issue40309] “unmatched paren” for space before parenthesis in Py_BuildValue

2020-04-17 Thread Gerrit Ansmann

New submission from Gerrit Ansmann :

According to the C-API documentation¹ for `Py_BuildValue`:

> The characters space, tab, colon and comma are ignored in format strings (but 
> not within format units such as s#). This can be used to make long format 
> strings a tad more readable.

However format strings such as `"(d )"` cause the error:

> Unmatched paren in format

By contrast `"( d)"` and `"(d d)"` cause no problems. I therefore assume that 
tuples are not considered “format units” in the sense of the above quote and 
this is a bug. Alternatively, the documentation needs clarification.

I could reproduce this problem with Python 3.7 and 3.8. I did not try other 
versions.

Appended is a minimal C extension exhibiting the problem. I compile and run 
with:

gcc -fPIC -I/usr/include/python3.8 -c foo.c -o foo.o
gcc -shared foo.o -o foo.so
python3.8 -c "import foo; foo.bar()"



¹ https://docs.python.org/3/c-api/arg.html

--
components: C API
files: foo.c
messages: 366647
nosy: Wrzlprmft
priority: normal
severity: normal
status: open
title: “unmatched paren” for space before parenthesis in Py_BuildValue
versions: Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49069/foo.c

___
Python tracker 
<https://bugs.python.org/issue40309>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27059] find_spec and find_loader ignore package/path argument

2016-05-19 Thread Gerrit Ansmann

New submission from Gerrit Ansmann:

According to my understanding, the `package`/`path` argument of the 
`find_loader`/`find_spec` command should enable it to find modules in other 
directories than the current one. Instead, these arguments seem to be ignored 
and even changing the working directory from within Python (using os.chdir) 
does not yield the expected results with `find_spec`.

I append a script with several test cases that should succeed in my 
understanding, but some of which don’t.

Python version: 3.4.3.
OS: Ubuntu 14.04.4
Pertinent Stack Overflow question: http://stackoverflow.com/a/37260391/2127008

--
components: Library (Lib)
files: test.py
messages: 265882
nosy: Wrzlprmft, brett.cannon
priority: normal
severity: normal
status: open
title: find_spec and find_loader ignore package/path argument
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file42903/test.py

___
Python tracker 
<http://bugs.python.org/issue27059>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue27059] find_spec and find_loader ignore package/path argument

2016-05-20 Thread Gerrit Ansmann

Gerrit Ansmann added the comment:

> If you think the docs aren't clear enough then please feel free to submit a 
> patch to make them a bit clearer.

I intend to do that. However, before I do so: Given that `find_loader` shall be 
superseded by `find_spec`, how would I use the latter to find the specs of a 
module that is not located in the current path, i.e., what is the current, 
non-deprecated way of doing `find_loader("spam", ["/foo/bar/"])`?

--

___
Python tracker 
<http://bugs.python.org/issue27059>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com