[issue37221] PyCode_New API change breaks backwards compatibility policy

2019-07-07 Thread Stefan Behnel


Stefan Behnel  added the comment:

No need to keep this bug open on CPython side. The backwards compatibility has 
been restored (and I'll release Cython 0.29.12 today to resolve the issue on 
that side.)

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue21120] PyArena type is used in headers from the limited API

2019-07-07 Thread Zackery Spytz


Change by Zackery Spytz :


--
components: +Build -Library (Lib)
nosy: +ZackerySpytz
versions: +Python 3.9 -Python 3.5

___
Python tracker 

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



[issue26952] argparse help formatter crashes

2019-07-07 Thread Alexander Kapshuna


Alexander Kapshuna  added the comment:

I have a feeling that nesting groups has nothing to do with it. Got same 
traceback when I forgot to fill my mutually exclusive groups with arguments. 

import argparse

parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
parser.parse_args(['-h'])

# Result:

Traceback (most recent call last):
  File "/home/kapsh/.PyCharmCE2019.1/config/scratches/scratch_12.py", line 5, 
in 
parser.parse_args(['-h'])
  File "/usr/lib/python3.7/argparse.py", line 1749, in parse_args
args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python3.7/argparse.py", line 1781, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python3.7/argparse.py", line 1987, in _parse_known_args
start_index = consume_optional(start_index)
  File "/usr/lib/python3.7/argparse.py", line 1927, in consume_optional
take_action(action, args, option_string)
  File "/usr/lib/python3.7/argparse.py", line 1855, in take_action
action(self, namespace, argument_values, option_string)
  File "/usr/lib/python3.7/argparse.py", line 1037, in __call__
parser.print_help()
  File "/usr/lib/python3.7/argparse.py", line 2474, in print_help
self._print_message(self.format_help(), file)
  File "/usr/lib/python3.7/argparse.py", line 2458, in format_help
return formatter.format_help()
  File "/usr/lib/python3.7/argparse.py", line 284, in format_help
help = self._root_section.format_help()
  File "/usr/lib/python3.7/argparse.py", line 215, in format_help
item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.7/argparse.py", line 215, in 
item_help = join([func(*args) for func, args in self.items])
  File "/usr/lib/python3.7/argparse.py", line 322, in _format_usage
action_usage = format(optionals + positionals, groups)
  File "/usr/lib/python3.7/argparse.py", line 397, in _format_actions_usage
start = actions.index(group._group_actions[0])
IndexError: list index out of range

--
nosy: +kapsh

___
Python tracker 

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



[issue37519] Three inconsistent module attributes

2019-07-07 Thread Géry

New submission from Géry :

Analysis


In the next two sections showing the module attributes and corresponding spec 
attributes of imported modules and run modules, we notice the following rule 
(which is in accordance with this `PEP 451 section 
`_):

If a *spec* attribute is either ``None``, ``'built-in'`` or ``'frozen'``, 
then the corresponding *module* attribute is not set.

However we also notice three exceptions to this rule, that I think are 
unintended inconsistencies that should be corrected:

- ``module.__file__ is None`` (instead of being not set) for imported namespace 
packages;
- ``module.__cached__ is None`` (instead of being not set) for non-package 
modules run from the file system and run from standard input;
- ``module.__package__ is None`` (instead of being ``''``) for non-package 
modules run from the file system and run from standard input.

The first exception was introduced recently (26 February 2018) by this `pull 
request `_, which changed the 
``module.__spec__.origin`` attribute from ``namespace`` to ``None`` (which I 
agree with as it avoids conflicting non-namespace-package modules named 
``namespace`` with namespace packages) and the ``module.__file__`` attribute 
from being unset to ``None`` (which I disagree with as it introduces an 
inconsistency and contradicts PEP 451).

Environment: CPython 3.7, MacOS 10.14.


Imported modules


Running the following code::

import module

print("MODULE")

for attr in ["__name__", "__file__", "__cached__", "__path__", 
"__package__", "__loader__"]:
print(f"{attr}:", repr(getattr(module, attr, "not set")))

print("SPEC")

if hasattr(module, "__spec__"):
if module.__spec__ is None:
print("__spec__:", repr(module.__spec__))
else:
for attr in ["name", "origin", "cached", 
"submodule_search_locations", "parent", "loader"]:
print(f"__spec__.{attr}:", repr(getattr(module.__spec__, attr)))
else:
print("__spec__: not set")

where ``module`` refers to:

- a non-package module (e.g., ``pathlib``);
- a regular package (e.g., ``json``);
- a namespace package;
- a built-in module (e.g., ``time``);
- a frozen module (e.g., ``_frozen_importlib_external``)

prints the following module attributes and corresponding spec attributes of the 
imported ``module``:

- for a non-package module:

| MODULE
| __name__: 'pathlib'
| __file__: 
'/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pathlib.py'
| __cached__: 
'/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/__pycache__/pathlib.cpython-37.pyc'
| __path__: 'not set'
| __package__: ''
| __loader__: <_frozen_importlib_external.SourceFileLoader object at 
0x1018896d8>
| SPEC
| __spec__.name: 'pathlib'
| __spec__.origin: 
'/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/pathlib.py'
| __spec__.cached: 
'/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/__pycache__/pathlib.cpython-37.pyc'
| __spec__.submodule_search_locations: None
| __spec__.parent: ''
| __spec__.loader: <_frozen_importlib_external.SourceFileLoader object at 
0x1018896d8>

- for a regular package:

| MODULE
| __name__: 'json'
| __file__: 
'/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py'
| __cached__: 
'/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__pycache__/__init__.cpython-37.pyc'
| __path__: 
['/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json']
| __package__: 'json'
| __loader__: <_frozen_importlib_external.SourceFileLoader object at 
0x10f9aa6d8>
| SPEC
| __spec__.name: 'json'
| __spec__.origin: 
'/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py'
| __spec__.cached: 
'/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__pycache__/__init__.cpython-37.pyc'
| __spec__.submodule_search_locations: 
['/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json']
| __spec__.parent: 'json'
| __spec__.loader: <_frozen_importlib_external.SourceFileLoader object at 
0x10f9aa6d8>

- for a namespace package:

| MODULE
| __name__: 'foobar'
| __file__: None
| __cached__: 'not set'
| __path__: _NamespacePath(['/Users/maggyero/foobar'])
| __package__: 'foobar'
| __loader__: <_frozen_importlib_external._NamespaceLoader object at 
0x1074564a8>
| SPEC
| __spec__.name: 'foobar'
| __spec__.origin: None
| __spec__.cached: None
| __spec__.submodule_search_locations: 
_NamespacePath(['/Users/maggyero/foobar'])
| __spec__.parent: 'foobar'
| __spec__.loader: <_frozen_importlib_external._NamespaceLoader object at 
0x1074564a8>

- for a buil

[issue37513] Fix a type error in ctypes.rst

2019-07-07 Thread Xiang Zhang


Xiang Zhang  added the comment:

Should be TypeError. It's changed from ValueError to TypeError in 
https://bugs.python.org/issue1831.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue37513] Fix a type error in ctypes.rst

2019-07-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14449
pull_request: https://github.com/python/cpython/pull/14635

___
Python tracker 

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



[issue37513] Fix a type error in ctypes.rst

2019-07-07 Thread Xiang Zhang


Xiang Zhang  added the comment:


New changeset f6cdd3ff687ebbf8209d793a18a042ea495c4aeb by Xiang Zhang (Hai Shi) 
in branch 'master':
bpo-37513: Change ValueError to TypeError in an example in ctypes doc (GH-14615)
https://github.com/python/cpython/commit/f6cdd3ff687ebbf8209d793a18a042ea495c4aeb


--

___
Python tracker 

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



[issue37513] Fix a type error in ctypes.rst

2019-07-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14450
pull_request: https://github.com/python/cpython/pull/14636

___
Python tracker 

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



[issue37513] Fix a type error in ctypes.rst

2019-07-07 Thread miss-islington


miss-islington  added the comment:


New changeset bc0a6ced30267d4e21e7566bfd6d14b30d6d1604 by Miss Islington (bot) 
in branch '3.7':
bpo-37513: Change ValueError to TypeError in an example in ctypes doc (GH-14615)
https://github.com/python/cpython/commit/bc0a6ced30267d4e21e7566bfd6d14b30d6d1604


--
nosy: +miss-islington

___
Python tracker 

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



[issue37513] Fix a type error in ctypes.rst

2019-07-07 Thread miss-islington


miss-islington  added the comment:


New changeset 3f7d0c9665ca546bb0073376cb83e31dd13b48d9 by Miss Islington (bot) 
in branch '3.8':
bpo-37513: Change ValueError to TypeError in an example in ctypes doc (GH-14615)
https://github.com/python/cpython/commit/3f7d0c9665ca546bb0073376cb83e31dd13b48d9


--

___
Python tracker 

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



[issue37513] Fix a type error in ctypes.rst

2019-07-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14451
pull_request: https://github.com/python/cpython/pull/14637

___
Python tracker 

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



[issue34446] ambiguous _max_size parameter in SpooledTemporaryFile

2019-07-07 Thread Andrew Scheller

Andrew Scheller  added the comment:

I agree that this is ambiguous behaviour. The docs at 
https://docs.python.org/3/library/tempfile.html#tempfile.SpooledTemporaryFile 
say "This function operates exactly as TemporaryFile() does, except that data 
is spooled in memory until the file size exceeds max_size, or until the file’s 
fileno() method is called, at which point the contents are written to disk and 
operation proceeds as with TemporaryFile().", and as the default value for 
max_size is 0, that would imply to me that _any_ data written to a 
SpooledTemporaryFile (constructed with a max_size of 0) would instantly get 
(internally) converted to a TemporaryFile.

Whereas looking at the code 
https://github.com/python/cpython/blob/master/Lib/tempfile.py#L650 it seems a 
max_size of 0 means "don't rollover". Perhaps it would have made sense to have 
SpooledTemporaryFile default to a max_size of None (and use that to mean "never 
rollover") ?

So as well as the inconsistency between rollover behaviour in the 
write()/writelines() methods and the truncate() method (when max_size is 0) 
that jcc2220 pointed out, I believe there's also a documentation issue here in 
that it's not clear what a max_size of 0 is /supposed/ to do.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, lurchman
versions: +Python 2.7, Python 3.5, Python 3.6, Python 3.8, Python 3.9

___
Python tracker 

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



[issue37513] Fix a type error in ctypes.rst

2019-07-07 Thread miss-islington


miss-islington  added the comment:


New changeset 00bf4d64ecb01027be40c32d822e47e55d6b5c76 by Miss Islington (bot) 
in branch '2.7':
bpo-37513: Change ValueError to TypeError in an example in ctypes doc (GH-14615)
https://github.com/python/cpython/commit/00bf4d64ecb01027be40c32d822e47e55d6b5c76


--

___
Python tracker 

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



[issue37513] Fix a wrong exception type in ctypes documentation

2019-07-07 Thread Xiang Zhang


Change by Xiang Zhang :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
title: Fix a type error in ctypes.rst -> Fix a wrong exception type in ctypes 
documentation
versions: +Python 2.7, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue26952] argparse help formatter crashes

2019-07-07 Thread paul j3


paul j3  added the comment:

Xiang Zhang pointed out that the immediate error in this case was caused by the 
empty mutually exclusive group:

https://bugs.python.org/issue26952#msg264835

The nesting fails because adding actions to the argument_group does not enroll 
them in the mutually exclusive group.  So the group._group_actions list remains 
empty, just as it is in your case.

As I pointed out earlier, the usage formatter is brittle.  The addition of 
mutually exclusive group markings is particularly clunky.

--

___
Python tracker 

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



[issue37510] argparse removing more "--" than it should

2019-07-07 Thread paul j3


paul j3  added the comment:

https://bugs.python.org/file29845/dbldash.patch

while written against an earlier version of `argparse`, does what you want.  I 
moved the '--' removal out of `_get_values` and into `consume_positionals`.

Note that a full patch should include test cases and documentation changes if 
any.  

Also now github pull requests are the preferred patching route.  But don't 
expect rapid response on this.  The issue has been around for a long time 
without causing too many complaints.  

Backward compatibility is always a concern when making changes to core 
functionality.  We don't want to mess with someone's working code. 
 Though I doubt if there are many users who count on multiple '--' removals, 
one way or other.  The argparse docs explicity calls this a 'pseudo-argument'.

--

___
Python tracker 

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



[issue37520] zipfile.Path.parent returns incorrect value (same as self) for directory ref

2019-07-07 Thread Jason R. Coombs


New submission from Jason R. Coombs :

Originally reported in https://github.com/jaraco/zipp/issues/7, the parent of a 
Path object referencing a directory is returning the incorrect result:

cpython master $ docker run -it python:rc-buster
 
Python 3.8.0b1 (default, Jun 27 2019, 22:38:51) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import zipfile
>>> import io
>>> zf = zipfile.ZipFile(io.BytesIO(), 'w')
>>> p = zipfile.Path(zf)
>>> p.joinpath('missing/').parent
Path(None, 'missing/')
>>> p.joinpath('missing/').parent.at
'missing/'

The expected value is '' as the parent of a single-level directory is the 
parent directory.

--
components: Library (Lib)
messages: 347479
nosy: jaraco
priority: normal
severity: normal
status: open
title: zipfile.Path.parent returns incorrect value (same as self) for directory 
ref
versions: Python 3.8

___
Python tracker 

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



[issue37520] zipfile.Path.parent returns incorrect value (same as self) for directory ref

2019-07-07 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
keywords: +patch
pull_requests: +14452
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14638

___
Python tracker 

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



[issue37520] zipfile.Path.parent returns incorrect value (same as self) for directory ref

2019-07-07 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset 38f44b4a4adc37e8f5f8971917d8b3145f351a56 by Jason R. Coombs in 
branch 'master':
bpo-37520: Correct behavior for zipfile.Path.parent (GH-14638)
https://github.com/python/cpython/commit/38f44b4a4adc37e8f5f8971917d8b3145f351a56


--

___
Python tracker 

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



[issue37520] zipfile.Path.parent returns incorrect value (same as self) for directory ref

2019-07-07 Thread miss-islington


Change by miss-islington :


--
pull_requests: +14453
pull_request: https://github.com/python/cpython/pull/14641

___
Python tracker 

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



[issue37520] zipfile.Path.parent returns incorrect value (same as self) for directory ref

2019-07-07 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset 66905d14672517d50dc8ba516b9839f9ddbcc131 by Jason R. Coombs (Miss 
Islington (bot)) in branch '3.8':
bpo-37520: Correct behavior for zipfile.Path.parent (GH-14638) (GH-14641)
https://github.com/python/cpython/commit/66905d14672517d50dc8ba516b9839f9ddbcc131


--

___
Python tracker 

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



[issue37520] zipfile.Path.parent returns incorrect value (same as self) for directory ref

2019-07-07 Thread Jason R. Coombs


Change by Jason R. Coombs :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue37521] importlib.util.module_from_spec return value is not the same as in sys.modules

2019-07-07 Thread Benjamin Mintz


New submission from Benjamin Mintz :

unzip the attached zip file and run main.py

expected output:

True


actual output:
False


So what?
If you follow these directions, 
https://docs.python.org/3.7/library/importlib.html#checking-if-a-module-can-be-imported
 , you will put a stale reference in sys.modules even though a fresh reference 
is already there. If you use that code on a package with a subpackage, the 
subpackage will not be set as an attribute on the package.

--
components: Library (Lib)
files: importsfucked.zip
messages: 347482
nosy: bmintz
priority: normal
severity: normal
status: open
title: importlib.util.module_from_spec return value is not the same as in 
sys.modules
versions: Python 3.7
Added file: https://bugs.python.org/file48460/importsfucked.zip

___
Python tracker 

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



[issue37521] importlib.util.module_from_spec return value is not the same as in sys.modules

2019-07-07 Thread Benjamin Mintz


Benjamin Mintz  added the comment:

Updated main.py.

New expected output:

True



New actual output:
==
False

Traceback (most recent call last):
  File "main.py", line 14, in 
print(module.sub)
AttributeError: module 'testext' has no attribute 'sub'

--
Added file: https://bugs.python.org/file48461/importsfucked.zip

___
Python tracker 

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



[issue37521] importlib.util.module_from_spec return value is not the same as in sys.modules

2019-07-07 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue37476] Adding a unit test of unicode in test_unicode.py

2019-07-07 Thread Xiang Zhang


Change by Xiang Zhang :


--
type:  -> enhancement
versions: +Python 3.9

___
Python tracker 

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



[issue37502] Fix default argument handling for buffers argument in pickle.loads

2019-07-07 Thread Kyle Stanley


Kyle Stanley  added the comment:

Thanks for reporting the issue. On PR-14593 I reviewed the changes with 
interpreter screenshots showing the output of "pickle.loads(pickle.dumps(1, 
protocol=pickle.HIGHEST_PROTOCOL), buffers=None)" in the latest version of 
cpython master compared to the branch from the PR.

--
nosy: +aeros167

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-07-07 Thread Steve Dower


Steve Dower  added the comment:

Heh, and I was so sure I'd copy pasted the right number after getting it wrong 
so often.

Just tag it against this bug.

--

___
Python tracker 

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



[issue19696] Merge all (non-syntactic) import-related tests into test_importlib

2019-07-07 Thread Kyle Stanley


Change by Kyle Stanley :


--
pull_requests: +14454
pull_request: https://github.com/python/cpython/pull/14642

___
Python tracker 

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