[issue32408] Performance regression in urllib.proxy_bypass_environment

2021-03-31 Thread Xiang Zhang


Xiang Zhang  added the comment:

Sorry, it's #39057

--

___
Python tracker 

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



[issue32408] Performance regression in urllib.proxy_bypass_environment

2021-03-31 Thread Xiang Zhang


Xiang Zhang  added the comment:

I think this issue has already been solved by #39507. The time difference is:

before:

time python3 -c 'import urllib.request; 
urllib.request.proxy_bypass_environment("1.1.1.1")'

real0m0.912s
user0m0.902s
sys 0m0.010s

after:

time python3 -c 'import urllib.request; 
urllib.request.proxy_bypass_environment("1.1.1.1")'

real0m0.105s
user0m0.086s
sys 0m0.019s

--
nosy: +serhiy.storchaka
resolution:  -> fixed
stage:  -> 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



[issue43688] [C API] Fix Py_INCREF and Py_DECREF in the limited C API for Python built in debug mode

2021-03-31 Thread STINNER Victor


New submission from STINNER Victor :

Currently, setup.py doesn't build xxlimited and xxlimited_35 extension modules 
with the limited C API if Python is built in debug mode. I only found two 
functions affected by Py_DEBUG macro in the limited C API: Py_INCREF() and 
Py_DECREF().

Example:
---
#if defined(Py_DEBUG) && !defined(Py_REF_DEBUG)
#define Py_REF_DEBUG
#endif

static inline void _Py_INCREF(PyObject *op)
{
#ifdef Py_REF_DEBUG
_Py_RefTotal++;
#endif
op->ob_refcnt++;
}
#define Py_INCREF(op) _Py_INCREF(_PyObject_CAST(op))
---

If Py_DEBUG is defined (Python built in debug mode), Py_INCREF() increments the 
private _Py_RefTotal variable.

The limited C API is supposed to provide a stable ABI, but Py_INCREF() leaks 
_Py_RefTotal implementation if Python is built in debug mode.

I propose to modify Py_INCREF() and Py_DECREF() of the limited C API to always 
declare them as opaque function calls. The regular (non limited) C API will 
continue to use the same static inline functions.

See also https://github.com/python/cpython/pull/25115 and bpo-4 "[C API] 
Convert a few stdlib extensions to the limited C API (PEP 384)".

Note: Py_XINCREF() and Py_XDECREF() should be fine.

--
components: C API
messages: 389956
nosy: vstinner
priority: normal
severity: normal
status: open
title: [C API] Fix Py_INCREF and Py_DECREF in the limited C API for Python 
built in debug mode
versions: Python 3.10

___
Python tracker 

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



[issue43670] Typo in 3.10 changelog

2021-03-31 Thread Inada Naoki


Inada Naoki  added the comment:

Thank you for reporting. This typo is fixed in GH-43574.

--
nosy: +methane
resolution:  -> fixed
stage:  -> 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



[issue43567] regen.vcxproj cannot regenerate some necessary files

2021-03-31 Thread Jiaxin Peng


Jiaxin Peng  added the comment:

Steve's PR zooba:bpo-43567 works as expected. Really clean implementation!
Thanks!

--
resolution:  -> works for me

___
Python tracker 

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



[issue43686] re.match appears to hang with certain combinations of pattern and string

2021-03-31 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

It's well-known that regular expressions can take exponential time. You can try 
searching this bug tracker for "re exponential". Common suggestions are to try 
a third-party module, or to write better regexes where possible. Note that the 
important bits of the re module are already implemented in C:

https://github.com/python/cpython/blob/master/Modules/_sre.c

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue43685] __call__ not being called on metaclass

2021-03-31 Thread Joël Larose

Joël Larose  added the comment:

OMG!  Ok, thanks guys!  Switching to super().__new__ made all the difference!  
I can't believe I didn't think to try to change this line.

Regarding the call to cast, I know it's only for type checking.  Trying to 
write code that works checks with mypy.

I probably have other issues in my code, but not getting __call__ called was 
the show-stopper.  I thought type(name, bases, namespace) did the same thing as 
super().__new__(...).  Clearly, I was wrong.

--
resolution:  -> not a bug
stage:  -> 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



[issue43685] __call__ not being called on metaclass

2021-03-31 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

typing.cast doesn't actually do anything, it only exists as a hint for 
type-checkers.

As William noted, using the 3-argument type(...) as you showed will only return 
a type, not a mcs.

I think you may want super().__new__(mcs, name, bases, namespace), which will 
return an instance of mcs. You could also write type.__new__(mcs, name, bases, 
namespace), but that would make multiple inheritance harder should you ever 
want to do that. 

Another note: x(*args) translates to type(x).__call__(x, *args), so whether or 
not I am callable depends not on whether I have a __call__ attribute, but 
rather on whether my type has a __call__ attribute

See also: https://stackoverflow.com/q/6760685/11461120

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue43687] use unicode_state empty string before unicode_init. without define WITH_DOC_STRINGS

2021-03-31 Thread junyixie


Change by junyixie :


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

___
Python tracker 

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



[issue43687] use unicode_state empty string before unicode_init. without define WITH_DOC_STRINGS

2021-03-31 Thread junyixie


New submission from junyixie :

use unicode_state empty string before unicode_init. without define 
WITH_DOC_STRINGS.

PyType_Ready call PyUnicode_FromString, if doc string striped, cause crash.

unicode_get_empty() must not be called before _PyUnicode_Init() or after 
_PyUnicode_Fini()

PyType_Ready
```
const char *old_doc = _PyType_DocWithoutSignature(type->tp_name,type->tp_doc);
PyObject *doc = PyUnicode_FromString(old_doc);
```

--
messages: 389950
nosy: JunyiXie
priority: normal
severity: normal
status: open
title: use unicode_state empty string before unicode_init. without define 
WITH_DOC_STRINGS
type: crash
versions: Python 3.10

___
Python tracker 

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



[issue43651] PEP 597: Fix EncodingWarning warnings in the Python stdlib

2021-03-31 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +23875
pull_request: https://github.com/python/cpython/pull/25128

___
Python tracker 

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



[issue43686] re.match appears to hang with certain combinations of pattern and string

2021-03-31 Thread Alexander Grigoriev


New submission from Alexander Grigoriev :

Certain patterns and input strings cause re.match to take exponentially longer 
time. This can be expected because of recursive nature of matching some 
patterns, but it can take surprisingly long time with some combination of a 
pattern and input data of moderate length. For example:

import re
import time

t1 = time.monotonic()
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_ 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n')
t2 = time.monotonic()
print(r"re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_ {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): %s s" % (t2-t1))
t1 = time.monotonic()
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_D 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n')
t2 = time.monotonic()
print(r"re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_D {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): %s s" % 
(t2-t1))
t1 = time.monotonic()
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_DI 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n')
t2 = time.monotonic()
print(r"re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_DI {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): %s s" % 
(t2-t1))
t1 = time.monotonic()
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_DIS 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n')
t2 = time.monotonic()
print(r"re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_DIS {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): %s s" % 
(t2-t1))
t1 = time.monotonic()
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_DISP 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n')
t2 = time.monotonic()
print(r"re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_DISP {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): %s s" % 
(t2-t1))
t1 = time.monotonic()
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_DISPL 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n')
t2 = time.monotonic()
print(r"re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_DISPL {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): %s s" % 
(t2-t1))
t1 = time.monotonic()
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_DISPLA {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n')
t2 = time.monotonic()
print(r"re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_DISPLA {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): %s s" % 
(t2-t1))
t1 = time.monotonic()
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_DISPLAY {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n')
t2 = time.monotonic()
print(r"re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_DISPLAY {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): %s s" % 
(t2-t1))


Does:

re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_ 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): 0.219000409782 s
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_D 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): 0.452999795109 s
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_DI 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): 0.952999795109 s
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_DIS 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): 1.79700020489 s
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_DISP 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): 3.609001713634 s
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define EVENT_DISPL 
{\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): 7.125 s
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_DISPLA {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): 
14.89099828637 s
re.match(rb'((?: |\t)*)((?:.*?(?:\\(?: |\t)+)?)*)(\s*)$', b'#define 
EVENT_DISPLAY {\t\\\r\n\tif {\t\\\r\n\t\tmnt_disp;\t\\\r\n\t} }\r\n'): 
29.68800081956 s


Perhaps re.match needs to be optimized and/or rewritten in low level language 
(C)

--
components: Library (Lib)
messages: 389949
nosy: alegrigoriev
priority: normal
severity: normal
status: open
title: re.match appears to hang with certain combinations of pattern and string
type: performance
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



[issue43685] __call__ not being called on metaclass

2021-03-31 Thread William Pickard


William Pickard  added the comment:

This line is the cause of your issue: "new_cls: SingletonMeta = 
cast(SingletonMeta, type(name, bases, namespace))"

More specifically, your call to type() actually erases all information about 
your meta class. If you did "type(S)", you would've seen "type" returned.

Replace it with: "new_cls: SingletonMeta = super().__new__(name, bases, 
namespace)"

--
nosy: +WildCard65

___
Python tracker 

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



[issue43651] PEP 597: Fix EncodingWarning warnings in the Python stdlib

2021-03-31 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +23874
pull_request: https://github.com/python/cpython/pull/25127

___
Python tracker 

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



[issue43651] PEP 597: Fix EncodingWarning warnings in the Python stdlib

2021-03-31 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +23873
pull_request: https://github.com/python/cpython/pull/25126

___
Python tracker 

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



[issue43685] __call__ not being called on metaclass

2021-03-31 Thread Joël Larose

New submission from Joël Larose :

Hi,

I'm trying to implement a metaclass for the singleton pattern, with the intent 
of creating type-appropriate sentinels.  After trying several approaches, I've 
come up with what I thought would be an elegant solution.  

However, I've run into a bit of a snag.  Whenever I "call" the class to get the 
instance, the machinery behind the scenes always calls __init__.  To bypass 
this, I tried overriding type.__call__ in my metaclass.  Contrary to all the 
documentation I've read, metaclass.__call__ is not being used.  The call 
sequence goes straight to class.__new__ and class.__init__.

=
M = TypeVar("M")

class SingletonMeta(type):
"""Metaclass for single value classes."""
def __call__(cls: Type[M], *args: Any, **kwargs: Any) -> M:

### Never see this line of output
print(f"{cls.__name__}.__call__({args=}, {kwargs=}")

it: Optional[M] = cast(Optional[M], cls.__dict__.get("__it__"))
if it is not None:
return it

try:
it = cls.__new__(*args, **kwargs)
it.__init__(*args, **kwargs)
except TypeError:
it = cls.__new__()
it.__init__()

# cls.__it__ = it
return it

def __new__(mcs, name: str, bases: th.Bases, namespace: th.DictStrAny,
**kwargs: Any) -> SingletonMeta:
print(f"{mcs.__name__}.__new__({name=}, {bases=}, {namespace=}, 
{kwargs=}")
new_cls: SingletonMeta = cast(SingletonMeta, type(name, bases, 
namespace))
print(f"{new_cls=}")
print(f"{new_cls.__call__}")

### Both of these lines ignore the __call__ defined in this metaclass
### They produce TypeError if the class doesn't define __new__ or 
__init__ accepting arguments
# new_cls.__it__ = new_cls(new_cls, **kwargs)
# new_cls.__it__ = new_cls.__call__(new_cls, **kwargs)

return new_cls


Here's the output I get after defining the metaclass and try to use it:
>>> class S(metaclass=SingletonMeta):
...pass
SingletonMeta.__new__(name='S', bases=(), namespace={'__module__': '__main__', 
'__qualname__': 'S'}, kwargs={}
new_cls=

>>> S()
<__main__.S object at 0x02C128AE5940>
>>> S()
<__main__.S object at 0x02C128AE56A0>


If SingletonMeta.__call__ was being used, I would see the output from that 
call, and consecutive calls to S() would yield the same object (with the same 
address).  As you can see, that is not the case.


Environment: 
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct  5 2020, 15:34:40) [MSC v.1927 64 bit 
(AMD64)] on win32

Is this a bug?  Or am I misunderstanding how/when __call__ gets called?

--
components: Interpreter Core
messages: 389947
nosy: joel.larose
priority: normal
severity: normal
status: open
title: __call__ not being called on metaclass
type: behavior
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



[issue43651] PEP 597: Fix EncodingWarning warnings in the Python stdlib

2021-03-31 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 58cffba1874f0e9a9731b25a3e11a011bfbbf95f by Inada Naoki in branch 
'master':
bpo-43651: Fix EncodingWarning in test_io (GH-25097)
https://github.com/python/cpython/commit/58cffba1874f0e9a9731b25a3e11a011bfbbf95f


--

___
Python tracker 

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



[issue43651] PEP 597: Fix EncodingWarning warnings in the Python stdlib

2021-03-31 Thread Inada Naoki


New submission from Inada Naoki :


New changeset 55f31be44b7e3ee24a67134f99543512a9b630e4 by Inada Naoki in branch 
'master':
bpo-43651: Fix EncodingWarning in test_file and test_file_eintr (GH-25109)
https://github.com/python/cpython/commit/55f31be44b7e3ee24a67134f99543512a9b630e4


--

___
Python tracker 

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



[issue42914] pprint numbers with underscore

2021-03-31 Thread Wm. Keith van der Meulen


Change by Wm. Keith van der Meulen :


--
nosy: +wkeithvan
nosy_count: 7.0 -> 8.0
pull_requests: +23872
pull_request: https://github.com/python/cpython/pull/25124

___
Python tracker 

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



[issue43330] xmlrpc.Server URI query and fragment are discarded from HTTP query since py3

2021-03-31 Thread Julien Castiaux


Julien Castiaux  added the comment:

Duplicate of 43433

--
message_count: 1.0 -> 2.0
pull_requests: +23871
resolution:  -> duplicate
status: open -> closed
pull_request: https://github.com/python/cpython/pull/25057

___
Python tracker 

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



[issue43593] pymalloc is not aware of Memory Tagging Extension (MTE) and crashes

2021-03-31 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

> If MTE is actually being used, system software assigns "random" values to 4 
> of the higher-order bits.

Oh, interesting.

Two ideas about handling that: we could change our assertion check to be 
different on ARM platforms that we know have a certain size physical address 
space.  Probably just turn off that high-bits check.

Second idea, we could change the radix tree to not assume high address bits are 
unused.  That's trickier to do without performance or memory usage 
degradations.  I have a work-in-progress patch that adds a cache on top of the 
radix tree lookup.  It looks like that cache can be made to have a pretty high 
hit rate.  Based on a small amount of testing, the radix tree lookup for 
address_in_range() only happens about 1% of the time.  If that approach works, 
we could add another layer to the tree and handle the full 64-bit address space.

Based on my wip testing, my benchmark was showing about equal performance with 
the cache to without.  So, no benefit to offset the increase in code 
complexity.  Handling the MTE high bits tricks might enough to justify the 
cache addition.

--
versions: +Python 3.9 -Python 3.8

___
Python tracker 

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



[issue42955] Add sys.stdlib_module_names: list of stdlib module names (Python and extension modules)

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ad493edf5791e7abb2588852e876b8584945c653 by Victor Stinner in 
branch 'master':
bpo-42955: Add _overlapped to sys.stdlib_module_names (GH-25122)
https://github.com/python/cpython/commit/ad493edf5791e7abb2588852e876b8584945c653


--

___
Python tracker 

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



[issue42840] `type` takes **kwargs for __init_subclass__

2021-03-31 Thread miss-islington


miss-islington  added the comment:


New changeset b3c1e2c493e67f84b1034ac6c49492a459b0736d by Miss Islington (bot) 
in branch '3.9':
bpo-42840: Document providing kwargs to type. (GH-24173)
https://github.com/python/cpython/commit/b3c1e2c493e67f84b1034ac6c49492a459b0736d


--

___
Python tracker 

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



[issue43677] Descriptor.rst - Reference to Py_MethodType is not up to date

2021-03-31 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 4.0 -> 5.0
pull_requests: +23870
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25123

___
Python tracker 

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



[issue42955] Add sys.stdlib_module_names: list of stdlib module names (Python and extension modules)

2021-03-31 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23869
pull_request: https://github.com/python/cpython/pull/25122

___
Python tracker 

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



[issue37945] [Windows] test_locale.TestMiscellaneous.test_getsetlocale_issue1813() fails

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

> Great!  For the first time in over 2 years, the test suite passes on a 
> Windows repository build on my machine. 

Nice :-)

--

___
Python tracker 

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



[issue43684] Add combined opcodes

2021-03-31 Thread Guido van Rossum


Change by Guido van Rossum :


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

___
Python tracker 

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



[issue43684] Add combined opcodes

2021-03-31 Thread Guido van Rossum


New submission from Guido van Rossum :

I'm lining up some PRs (inspired by some of Mark Shannon's ideas) that add new 
opcodes which are straightforward combinations of existing opcodes. For 
example, ADD_INT is equivalent to LOAD_CONST + BINARY_ADD, for certain small 
(common) integer constants.

Each of these adds only a minor speedup, but after a dozen or so of these the 
speedup is (hopefully) significant enough to warrant the opcode churn.

--
messages: 389939
nosy: Mark.Shannon, eric.snow, gvanrossum, pablogsal
priority: normal
severity: normal
status: open
title: Add combined opcodes
type: performance
versions: Python 3.10

___
Python tracker 

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



[issue37945] [Windows] test_locale.TestMiscellaneous.test_getsetlocale_issue1813() fails

2021-03-31 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Great!  For the first time in over 2 years, the test suite passes on a Windows 
repository build on my machine.  I will test installed 3.10 after the next 
alpha release.  (3.10.0a7 has other failures as well.)

--

___
Python tracker 

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



[issue40092] Crash in _PyThreadState_DeleteExcept() at fork in the process child

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-43665 "AIX: test_importlib regression (ENV change)" as a duplicate 
of this issue.

test_multiprocessing_pool_circular_import() of test_importlib now triggers this 
crash as well.

--

___
Python tracker 

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



[issue43665] AIX: test_importlib regression (ENV change)

2021-03-31 Thread STINNER Victor


Change by STINNER Victor :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Crash in _PyThreadState_DeleteExcept() at fork in the process 
child

___
Python tracker 

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



[issue43665] AIX: test_importlib regression (ENV change)

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

Interesting part of the traceback:

pthread_cond_signal@AF29_12(??, ??) at 0xd11b1568
...
release_sentinel
...
_PyThreadState_DeleteExcept
...
PyOS_AfterFork_Child(), line 600 in "posixmodule.c"

It sounds like a variant of bpo-40092: "Crash in _PyThreadState_DeleteExcept() 
at fork in the process child".

See also the parent issue: https://bugs.python.org/issue40068#msg365031

--

___
Python tracker 

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



[issue43567] regen.vcxproj cannot regenerate some necessary files

2021-03-31 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue43567] regen.vcxproj cannot regenerate some necessary files

2021-03-31 Thread anthony shaw


anthony shaw  added the comment:

Guido, regen.vcxproj targets 142 as the SDK version, which is most likely a 
mistake.
The other projects are part of the main PCBuild.sln solution, which has a 
variable for the base SDK version.

If you need to change it quickly, you can either open it in VS and right click 
on the project and change the properties to an older SDK, or edit the vcxproj 
file itself.

I can make this change in a patch, but because its a standalone project, it 
doesn't share the base SDK version with the others.

I've reviewed Steve's patch and it would fix this because it changes regen into 
a build target instead of a build project, so it doesn't specify the SDK 
version at all.
Steve's implementation is also much, much cleaner!

--
nosy: +anthony shaw

___
Python tracker 

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



[issue24275] lookdict_* give up too soon

2021-03-31 Thread Hristo Venev


Hristo Venev  added the comment:

Sorry, I must have missed Inada Naoki's reply. I will try to send a pull 
request this weekend.

--

___
Python tracker 

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



[issue24275] lookdict_* give up too soon

2021-03-31 Thread Jim Jewett


Jim Jewett  added the comment:

What is the status on this?  If you are losing interest, would you like someone 
else to turn your patch into a pull request?

--

___
Python tracker 

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



[issue17305] IDNA2008 encoding is missing

2021-03-31 Thread Derek Wilson


Derek Wilson  added the comment:

why the downgrade from security to enhancement and critical to high?

this is a significant issue that can impact everything from phishing to TLS 
certificate domain validation and SNI.

--

___
Python tracker 

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



[issue43631] Update to OpenSSL 1.1.1k

2021-03-31 Thread Christian Heimes


Christian Heimes  added the comment:

CI, macOS and Windows infrastructure have been updated.

--
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



[issue17305] IDNA2008 encoding is missing

2021-03-31 Thread Christian Heimes


Change by Christian Heimes :


--
priority: critical -> high
type: security -> enhancement
versions: +Python 3.10 -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



[issue36997] Document that spwd is considered harmful

2021-03-31 Thread Christian Heimes


Change by Christian Heimes :


--
priority: high -> normal
type: security -> enhancement
versions: +Python 3.10 -Python 2.7, Python 3.7

___
Python tracker 

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



[issue36384] ipaddress Should not reject IPv4 addresses with leading zeroes as ambiguously octal

2021-03-31 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +lukasz.langa
priority: critical -> release blocker

___
Python tracker 

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



[issue43223] [security] http.server: Open Redirection if the URL path starts with //

2021-03-31 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes, lukasz.langa, ned.deily
priority: normal -> release blocker

___
Python tracker 

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



[issue43124] [security] smtplib multiple CRLF injection

2021-03-31 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes, lukasz.langa, ned.deily
priority: normal -> release blocker

___
Python tracker 

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



[issue43105] [Windows] Can't import extension modules resolved via relative paths in sys.path

2021-03-31 Thread Steve Dower


Steve Dower  added the comment:

Added one possible change as a PR, but will need the importlib folk to weigh in 
on whether it's the best place.

I also need to write a test (and possibly fix any tests that currently check 
that relative paths are _not_ resolved... letting CI handle that for me)

--

___
Python tracker 

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



[issue43105] [Windows] Can't import extension modules resolved via relative paths in sys.path

2021-03-31 Thread Steve Dower


Change by Steve Dower :


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

___
Python tracker 

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



[issue43567] regen.vcxproj cannot regenerate some necessary files

2021-03-31 Thread Guido van Rossum


Guido van Rossum  added the comment:

@Jiaxin Please test steve's PR.

--

___
Python tracker 

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



[issue43593] pymalloc is not aware of Memory Tagging Extension (MTE) and crashes

2021-03-31 Thread Tim Peters


Tim Peters  added the comment:

I'm skeptical ;-) If MTE is actually being used, system software assigns 
"random" values to 4 of the higher-order bits. When obmalloc punts to the 
system malloc, presumably those bits will be randomized in the addresses 
returned by malloc. Then it's just not possible that obmalloc's

assert(HIGH_BITS(p) == HIGH_BITS(&arena_map_root));

can always succeed - we're insisting there that _all_ the high-order bits are 
exactly the same as in the `&arena_map_root` file static.  If `p` was actually 
obtained from the system `malloc()`, it should fail about 15 times out of 16 
(and regardless of which of the 16 bit patterns the platform C assigns to 
&arena_map_root).

But, of course, that failure would only be seen in a debug build.

--
nosy: +tim.peters

___
Python tracker 

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



[issue43567] regen.vcxproj cannot regenerate some necessary files

2021-03-31 Thread Steve Dower


Steve Dower  added the comment:

I've attached my PR that streamlines this, it should be good (as in, 
reliable/fast) to do the regen on every build, but the "build.bat --regen" 
command is retained to force it.

--

___
Python tracker 

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



[issue43567] regen.vcxproj cannot regenerate some necessary files

2021-03-31 Thread Steve Dower


Change by Steve Dower :


--
keywords: +patch
pull_requests: +23866
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/25120

___
Python tracker 

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



[issue43492] Upgrade to SQLite 3.35.4 in macOS and Windows

2021-03-31 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Quoting Dr. R. Hipp: "There will be a fix called version 3.35.4"

https://sqlite.org/forum/forumpost/7dbf046041519a07a0a083b8346a7d0ecb7d6fc4eca5ca23605eeb4452109d91

--
title: Upgrade to SQLite 3.35.3 in macOS and Windows -> Upgrade to SQLite 
3.35.4 in macOS and Windows

___
Python tracker 

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



[issue4111] Add Systemtap/DTrace probes

2021-03-31 Thread hai shi


Change by hai shi :


--
pull_requests: +23865
pull_request: https://github.com/python/cpython/pull/25115

___
Python tracker 

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



[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-03-31 Thread hai shi


hai shi  added the comment:

> By the way, maybe Py_LIMITED_API should be defined in xxlimited.c, rather 
> than in setup.py.

+1. Defining Py_LIMITED_API in xxlimited.c is more direct than in setup.py. so 
I created the PR-25115.

--

___
Python tracker 

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



[issue4111] Add Systemtap/DTrace probes

2021-03-31 Thread hai shi


Change by hai shi :


--
pull_requests:  -23859

___
Python tracker 

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



[issue41111] [C API] Convert a few stdlib extensions to the limited C API (PEP 384)

2021-03-31 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue43567] regen.vcxproj cannot regenerate some necessary files

2021-03-31 Thread Guido van Rossum


Guido van Rossum  added the comment:

Anthony, can you help us out here? Is there a problem with regen.vcsproj, 
either by depending on VS 2019 (which we don't officially support yet) or by 
missing the changes in the names of some generated files?

--
nosy: +anthonypjshaw

___
Python tracker 

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



[issue43665] AIX: test_importlib regression (ENV change)

2021-03-31 Thread Michael Felt

Michael Felt  added the comment:

On 31/03/2021 18:46, STINNER Victor wrote:
> STINNER Victor  added the comment:
>
> test.test_importlib.test_threaded_import.ThreadedImportTests.test_multiprocessing_pool_circular_import
>
> This test comes from bpo-41567 and it simply runs a script. You can run 
the script directly:
>
> ./python -X dev Lib/test/test_importlib/partial/pool_in_threads.py ; echo $?

Status is zero -0 but I get a core dump!

aixtools@cpython2:[/home/aixtools/py3a-10.0]./python -X dev 
Lib/test/test_importlib/partial/pool_in_threads.py ; echo $?
0
aixtools@cpython2:[/home/aixtools/py3a-10.0]ls -ltr core
-rw-r--r--    1 aixtools staff 129435720 Mar 31 16:58 core

+++
Looking at the core dump - part 1.
+++

The address (0xd118ff80) hints at a shared library (pthread?)

I'll try to find it - but maybe you can just remind me - the CLI 
arguments to make Python more verbose about what it is doing.
Note: all addresses beginning with 0x1 (as in 0x101ca238) are program 
code addresses. 0x3 (0x30163ad8) imply a shared memory segment being 
created and used by the application.

Perhaps more relevant aree all these lines with what appear to be 
extreme argcount values, e.g., from the bottom:

_PyEval_Vector(tstate = 0x30187038, con = 0x20107b40, locals = 
0x30111768, args = 0x301219b8, argcount = 806560272, kwnames = 
0x301314d8), line 46 in "pycore_ceval.h"
_PyFunction_Vectorcall(func = (nil), stack = (nil), nargsf = 570570720, 
kwnames = (nil)), line 361 in "call.c"
_PyEval_EvalFrameDefault(tstate = (nil), f = 0x4000, throwflag = 

-257396708), line 1431 in "abstract.h"
_PyEval_Vector(tstate = 0x22023cf0, con = 0x2000120c, locals = 
0x22023960, args = 0x220239f0, argcount = 3508213100, kwnames = 
0x22023cf0), line 46 in "pycore_ceval.h"
_PyFunction_Vectorcall(func = 0x220239f0, stack = (nil), nargsf = 
570572016, kwnames = 0x220239f0), line 361 in "call.c"
method_vectorcall(method = 0x10103bdc, args = (nil), nargsf = 0, kwnames 
= 0x20045994), line 119 in "abstract.h"
PyVectorcall_Call(callable = 0x, tuple = 0x, kwargs = 

0x), line 255 in "call.c"
_PyObject_Call(tstate = (nil), callable = (nil), args = (nil), kwargs = 
(nil)), line 298 in "call.c"
thread_run(boot_raw = (nil)), line 1076 in "_threadmodule.c"

pythread_wrapper(arg = (nil)), line 240 in "thread_pthread.h"

+++
Looking at the core dump - the complete 'where' results:
+++

aixtools@cpython2:[/home/aixtools/py3a-10.0]dbx ./python core
Type 'help' for help.
[using memory image in core]
reading symbolic information ...

Trace/BPT trap in _internal_error at 0xd118ff80 ($t1)
0xd118ff80 (_internal_error+0x80) 80410014    lwz r2,0x14(r1)
(dbx) where
_internal_error(??, ??, ??) at 0xd118ff80
pth_usched._usched_dispatch_front._event_notify_locked@AF34_24(??, ??, 
??, ??, ??) at 0xd119fc2c
_event_notify(??, ??, ??) at 0xd119ee38
_cond_broadcast(??, ??, ??) at 0xd11af588
pthread_cond_signal@AF29_12(??, ??) at 0xd11b1568
pthread_cond_signal(??) at 0xd11afc88
PyThread_release_lock(lock = 0x10119354), line 692 in "thread_pthread.h"
release_sentinel(wr_raw = 0x10118f14), line 1289 in "_threadmodule.c"
PyThreadState_Clear(tstate = 0x101ca238), line 873 in "pystate.c"
_PyThreadState_DeleteExcept(runtime = 0xd5c234d0, tstate = 0x22021d30), 
line 987 in "pystate.c"
_PyEval_ReInitThreads(tstate = 0x30163ad8), line 506 in "ceval.c"
PyOS_AfterFork_Child(), line 600 in "posixmodule.c"
os_fork_impl(module = 0x3033a030), line 6659 in "posixmodule.c"
cfunction_vectorcall_NOARGS(func = 0x30337330, args = 0x302ec7d0, nargsf 
= 570564304, kwnames = 0x30337328), line 485 in "methodobject.c"
_PyEval_EvalFrameDefault(tstate = 0x302e058c, f = 0x302e847a, throwflag 
= 0), line 1431 in "abstract.h"
_PyEval_Vector(tstate = 0x302f2350, con = 0x20107b40, locals = 
0x302e8478, args = 0x302e79b8, argcount = 808016112, kwnames = 
0x302cd898), line 46 in "pycore_ceval.h"
_PyFunction_Vectorcall(func = 0x0008, stack = 0x3004d6e8, nargsf = 
570564752, kwnames = 0x302f6030), line 361 in "call.c"
_PyEval_EvalFrameDefault(tstate = 0x101c9554, f = 0x20107b40, throwflag 
= 570565024), line 1431 in "abstract.h"
_PyEval_Vector(tstate = 0x0018, con = 0x200084a0, locals = 
0x220221f0, args = 0x88000284, argcount = 269576140, kwnames = 
0x2007a390), line 46 in "pycore_ceval.h"
_PyFunction_Vectorcall(func = 0x2007a4e0, stack = 0x20107b40, nargsf = 
570565168, kwnames = 0x20045994), line 361 in "call.c"
_PyObject_FastCallDictTstate(tstate = 0x100a7e84, callable = 0x302ed780, 
args = 0x220222b0, nargsf = 537155988, kwargs = 0x100a8a54), line 142 in 
"call.c"
_PyObject_Call_Prepend(tstate = 0x1001fa24, callable = 0x302ce5d0, obj = 
0x22022320, args = 0x20045994, kwargs = 0x100feffc), line 431 in "call.c"
slot_tp_init(self = 0x302e06f0, args = 0x30122e76, kwds = 0x30122e70), 
line 7097 in "typeobject.c"
unnamed block in type_call(type = 0x10105284,

[issue29988] with statements are not ensuring that __exit__ is called if __enter__ succeeds

2021-03-31 Thread Mark Shannon


Mark Shannon  added the comment:

The bytecode instruction set has changed a lot since 3.6, so I think a backport 
would be impractical.

3.6 is in security fix only mode, so you'd need to take this up with Red Hat.

--

___
Python tracker 

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



[issue43683] Handle generator (and coroutine) state in the bytecode.

2021-03-31 Thread Mark Shannon


Change by Mark Shannon :


--
assignee:  -> Mark.Shannon
stage:  -> needs patch
type:  -> performance

___
Python tracker 

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



[issue43665] [AIX] test_importlib: test_multiprocessing_pool_circular_import() killed by SIGTRAP (coredump)

2021-03-31 Thread STINNER Victor


Change by STINNER Victor :


--
title: AIX: test_importlib regression (ENV change) -> [AIX] test_importlib: 
test_multiprocessing_pool_circular_import() killed by SIGTRAP (coredump)

___
Python tracker 

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



[issue43665] AIX: test_importlib regression (ENV change)

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

test.test_importlib.test_threaded_import.ThreadedImportTests.test_multiprocessing_pool_circular_import

This test comes from bpo-41567 and it simply runs a script. You can run the 
script directly:

./python -X dev Lib/test/test_importlib/partial/pool_in_threads.py ; echo $?

--

___
Python tracker 

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



[issue42823] Incorrect frame.f_lineno when frame.f_trace is set

2021-03-31 Thread Mark Shannon


Mark Shannon  added the comment:

Ned, can I close this?

--

___
Python tracker 

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



[issue43683] Handle generator (and coroutine) state in the bytecode.

2021-03-31 Thread Mark Shannon


New submission from Mark Shannon :

Every time we send, or throw, to a generator, the C code in genobject.c needs 
to check what state the generator is in. 
This is inefficient and couples the generator code, which should just be a thin 
wrapper around the interpreter, to the internals of the interpreter.

The state of the generator is known to the compiler. It should emit appropriate 
bytecodes to handle the different behavior for the different states.

While the main reason this is robustness and maintainability, removing the 
complex C code between Python caller and Python callee also opens up the 
possibility of some worthwhile optimizations.

There are three changes I want to make:

1. Add a new bytecode to handle starting a generator. This `GEN_START` bytecode 
would pop TOS, raising an exception if it is not None.
This adds some overhead for the first call to iter()/send() but speeds up all 
the others.

2. Handle the case of exhausted generators. This is a bit more fiddly, and 
involves putting an infinite loop at the end of the generator. Something like:

   CLEAR_FRAME
label:
   GEN_RETURN (Like RETURN_VALUE None, but does not discard the frame)
   JUMP label


This removes a lot of special case code for corner cases of exhausted 
generators and coroutines.

3. Handle throw() on `YIELD_FROM`. The problem here is that we need to 
differentiate between exceptions triggered by throw, which must call throw() on 
sub-generators, and exceptions propagating out of sub-generators which should 
be passed up the stack. By splitting the opcode into two (or more), it is clear 
which case is being handled in the interpreter without complicated logic in 
genobject.c

--
messages: 389919
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Handle generator (and coroutine) state in the bytecode.

___
Python tracker 

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



[issue28276] test_loading.py - false positive result for "def test_find" when find_library() is not functional or the (shared) library does not exist

2021-03-31 Thread Michael Felt


Michael Felt  added the comment:

Sure. Probably have to rebase first.

--

___
Python tracker 

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



[issue43682] Make static methods created by @staticmethod callable

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

> Isn't the problem that Python functions are (non-overriding) descriptors, but 
> builtin-functions are not descriptors?
> Changing static methods is not going to fix that.
> How about adding wrappers to make Python functions behave like builtin 
> functions and vice versa?

I would love consistency, but is that possible without breaking almost all 
Python projects?

Honestly, I'm annoying by the having to use staticmethod(), or at least the 
fact that built-in functions and functions implemented in Python don't behave 
the same. It's hard to remind if a stdlib function requires staticmethod() or 
not. Moreover, maybe staticmethod() is not needed today, but it would become 
required tomorrow if the built-in function becomes a Python function somehow.

So yeah, I would prefer consistency. But backward compatibility may enter into 
the game as usual. PR 25117 tries to minimize the risk of backward 
compatibility issues.

For example, if we add __get__() to built-in methods and a bound method is 
created on the following example, it means that all code relying on the current 
behavior of built-in functions (don't use staticmethod) would break :-(
---
class MyClass:
# built-in function currently converted to a method
# magically without having to use staticmethod()
method = len
---

Would it be possible to remove __get__() from FunctionType to allow using a 
Python function as a method? How much code would it break? :-) What would 
create the bound method on a method call?
---
def func():
...

class MyClass:
method = func

# magic happens here!
bound_method = MyClass().method
---

--

___
Python tracker 

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



[issue43682] Make static methods created by @staticmethod callable

2021-03-31 Thread STINNER Victor

STINNER Victor  added the comment:

> Changing static methods is not going to fix that.

My plan for the _pyio module is:

(1) Make static methods callable
(2) Decorate _pyio.open() with @staticmethod

That would only fix the very specific case of _pyio.open(). But open() use case 
seems to be common enough to became the example in the @staticmethod 
documentation!
https://docs.python.org/dev/library/functions.html#staticmethod

Example added in bpo-31567 "Inconsistent documentation around decorators" by:

commit 03b9537dc515d10528f83c920d38910b95755aff
Author: Éric Araujo 
Date:   Thu Oct 12 12:28:55 2017 -0400

bpo-31567: more decorator markup fixes in docs (GH-3959) (#3966)

--

___
Python tracker 

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



[issue43672] Raise ImportWarning when calling find_loader()

2021-03-31 Thread Brett Cannon


Change by Brett Cannon :


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

___
Python tracker 

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



[issue4928] tempfile.NamedTemporaryFile: automatic cleanup by OS

2021-03-31 Thread Hunor Portik


Hunor Portik  added the comment:

Hello

I would really appreciate and I think many of us if every time I havent have to 
remember everything. Im not a Sys admin, devops, or who has in his mind every 
low level step and just shakes out of his little finger...
Why do I have to take care at the high level where I stand with using Python? I 
think  mustn't.

So yes, as just a little noticement would be really helpful for us to remember 
we should look forward if we want to make sure. That's why Im here, and not 
reading the docs instead...

--
nosy: +portikhun

___
Python tracker 

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



[issue43682] Make static methods created by @staticmethod callable

2021-03-31 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +rhettinger

___
Python tracker 

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



[issue43682] Make static methods created by @staticmethod callable

2021-03-31 Thread Mark Shannon


Mark Shannon  added the comment:

Isn't the problem that Python functions are (non-overriding) descriptors, but 
builtin-functions are not descriptors?
Changing static methods is not going to fix that.

How about adding wrappers to make Python functions behave like builtin 
functions and vice versa?

--

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2021-03-31 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +23862
pull_request: https://github.com/python/cpython/pull/25118

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2021-03-31 Thread Ethan Furman


Change by Ethan Furman :


--
pull_requests: +23861
pull_request: https://github.com/python/cpython/pull/25116

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

> It is still can be set as a class attribute in user code, so I think that 
> removing OpenWrapper needs a deprecated period.

I'm fine with deprecating the function by defining a __getattr__() function in 
io.py and _pyio.py. But only if it doesn't block the implementation of the PEP 
597 ;-) The PEP 597 implementation issue is discussed at:
https://bugs.python.org/issue43510#msg389822

--

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

> OpenWrapper was added in ce3a72aec6eaa0293c397c8d0407f7afe0072b2f (issue1267) 
> and was only used to set __builtin__.open

It is useless in CPython, since CPython always use the C implementation of the 
io module, and in the io module, io.OpenWrapper is just an alias to io.open.

$ python3
Python 3.9.2 (default, Feb 20 2021, 00:00:00) 
>>> import io
>>> io.OpenWrapper is io.open
True


> (I suppose that at thet moment dumbdbm.py still set open as a class 
> attribute).

I failed to find where in Lib/dbm/dumb.py the open() function is used to define 
a method. Maybe the code changed since OpenWrapper was added?

At commit ce3a72aec6eaa0293c397c8d0407f7afe0072b2f, the io module was only 
implemented in Python (Lib/io.py, _io exist didn't exist). It was reimplemented 
in C in Python 3.1.

--

___
Python tracker 

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



[issue43665] AIX: test_importlib regression (ENV change)

2021-03-31 Thread Michael Felt

Michael Felt  added the comment:

On 30/03/2021 09:40, STINNER Victor wrote:
> STINNER Victor  added the comment:
>
> A core dump is a very bad sign of health.
>
> Can you please try to bisect which test is causing the segfault using 
> bisect_cmd? Try the command:
>
> ./python -m test.bisect_cmd -o bisect --fail-env-changed test_importlib
>
> The command should takes 10-60 minutes, and you should see the number of 
> tests decreasing. I hope that at the end, the command will identify a single 
> method triggering the crash.
>
> At the end, the create "bisect" file contains the test methods causing the 
> bug.
>
> Then you can re-run tests with:
>
> ./python -m test --fail-env-changed test_importlib --matchfile=bisect
I like this!:

Fortunately, it did not take 10  minutes:

Writing 1 tests into bisect

Tests (1):
* 
test.test_importlib.test_threaded_import.ThreadedImportTests.test_multiprocessing_pool_circular_import

Output written into bisect
Bisection completed in 34 iterations and 0:00:28

>
>
>> The core dump is caused by SIGTRAP. I need help to learn how to stop the 
>> core dump from being cleaned up so I can load it into dbx and hopefully 
>> understand/learn with sub-test is actually having issues.
> You can re-run the test without libregrtest by running it directly. Example:
>
> ./python -m test.test_importlib 
> test_spec.Frozen_ModuleSpecMethodsTests.test_reload -v

While - to use your example - using the normal verbose test syntax I do 
see the test you reference:

* test_reload 
(test.test_importlib.test_spec.Frozen_ModuleSpecMethodsTests) ... ok

but, when I run your example (and many variations) I always get 
something such as:

So, still - closer - but not quite there with:

+

./python -m test.test_importlib 
test_spec.Frozen_ModuleSpecMethodsTests.test_reload -v
test_spec (unittest.loader._FailedTest) ... ERROR

==
ERROR: test_spec (unittest.loader._FailedTest)
--
AttributeError: module '__main__' has no attribute 'test_spec'

--
Ran 1 test in 0.000s

FAILED (errors=1)
+

> It should create a core dump in the current directory, or you run the command 
> in your favorite debugger.
>
>
> My notes on debugging a Python crash: 
> https://pythondev.readthedocs.io/debug_tools.html#core-dump
>
> --
> nosy: +vstinner
>
> ___
> Python tracker 
> 
> ___
>

--
Added file: https://bugs.python.org/file49922/OpenPGP_0x722BFDB61F396FC2.asc

___
Python tracker 

___

OpenPGP_0x722BFDB61F396FC2.asc
Description: application/pgp-keys
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43682] Make static methods created by @staticmethod callable

2021-03-31 Thread STINNER Victor


Change by STINNER Victor :


--
title: Make function wrapped by staticmethod callable -> Make static methods 
created by @staticmethod callable

___
Python tracker 

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



[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

> I don't understand what the problem is. _pyio.open is a function not a static 
> method.

The problem is that _pyio.open doesn't behave exactly as io.open when it's used 
to define a method:
---
#from io import open
from _pyio import open

class MyClass:
   my_open = open

MyClass().my_open("document.txt", "w")
---

This code currently fails with a TypeError, whereas it works with io.open.

The problem is that I failed to find a way to create a function in Python which 
behaves exactly as built-in functions like len() or io.open().

--

___
Python tracker 

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



[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread Mark Shannon


Mark Shannon  added the comment:

I don't understand what the problem is. _pyio.open is a function not a static 
method.

>>> import _pyio
>>> _pyio.open


--
nosy: +Mark.Shannon
title: Make static methods created by @staticmethod callable -> Make function 
wrapped by staticmethod callable

___
Python tracker 

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



[issue20309] Not all method descriptors are callable

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

I proposed again a similar idea, but only for @staticmethod: bpo-43682.

--
nosy: +vstinner

___
Python tracker 

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



[issue43682] Make static methods created by @staticmethod callable

2021-03-31 Thread STINNER Victor


Change by STINNER Victor :


--
title: Make function wrapped by staticmethod callable -> Make static methods 
created by @staticmethod callable

___
Python tracker 

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



[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

> Seems like a duplicate of #20309.

My usecase is to avoid any behavior difference between io.open and _pyio.open 
functions: PEP 399 "Pure Python/C Accelerator Module Compatibility 
Requirements". Currently, this is a very subtle difference when it's used to 
define a method.

I dislike the current _pyio.OpenWrapper "hack". I would prefer that _pyio.open 
would be directly usable to define a method. I propose to use @staticmethod, 
but I am open to other ideas. It could be a new decorator: 
@staticmethod_or_function.

Is it worth it to introduce a new @staticmethod_or_function decorator just to 
leave @staticmethod unchanged?

Note: The PEP 570 "Python Positional-Only Parameters" (implemented in Python 
3.8) removed another subtle difference between functions implemented in C and 
functions implemented in Python. Now functions implemented in Python can only 
have positional only parameters.

--

___
Python tracker 

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



[issue43681] doctest forgets previous imports

2021-03-31 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread Mark Dickinson


Mark Dickinson  added the comment:

Seems like a duplicate of #20309.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue43682] Make function wrapped by staticmethod callable

2021-03-31 Thread STINNER Victor


New submission from STINNER Victor :

Currently, static methods created by the @staticmethod decorator are not 
callable as regular function. Example:
---
@staticmethod
def func():
print("my func")

class MyClass:
method = func

func() # A: regular function
MyClass.method() # B: class method
MyClass().method() # C: instance method
---

The func() call raises TypeError('staticmethod' object is not callable) 
exception.

I propose to make staticmethod objects callable to get a similar to built-in 
function:
---
func = len

class MyClass:
method = func

func("abc") # A: regular function
MyClass.method("abc") # B: class method
MyClass().method("abc") # C: instance method
---

The 3 variants (A, B, C) to call the built-in len() function work just as 
expected.

If static method objects become callable, the 3 variants (A, B, C) will just 
work.

It would avoid the hack like _pyio.Wrapper:
---
class DocDescriptor:
"""Helper for builtins.open.__doc__
"""
def __get__(self, obj, typ=None):
return (
"open(file, mode='r', buffering=-1, encoding=None, "
 "errors=None, newline=None, closefd=True)\n\n" +
open.__doc__)

class OpenWrapper:
"""Wrapper for builtins.open

Trick so that open won't become a bound method when stored
as a class variable (as dbm.dumb does).

See initstdio() in Python/pylifecycle.c.
"""
__doc__ = DocDescriptor()

def __new__(cls, *args, **kwargs):
return open(*args, **kwargs)
---

Currently, it's not possible possible to use directly _pyio.open as a method:
---
class MyClass:
method = _pyio.open
---

whereas "method = io.open" just works because io.open() is a built-in function.


See also bpo-43680 "Remove undocumented io.OpenWrapper and _pyio.OpenWrapper" 
and my thread on python-dev:

"Weird io.OpenWrapper hack to use a function as method"
https://mail.python.org/archives/list/python-...@python.org/thread/QZ7SFW3IW3S2C5RMRJZOOUFSHHUINNME/

--
components: Library (Lib)
messages: 389905
nosy: vstinner
priority: normal
severity: normal
status: open
title: Make function wrapped by staticmethod callable
versions: Python 3.10

___
Python tracker 

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



[issue43681] doctest forgets previous imports

2021-03-31 Thread Ethan Furman


Ethan Furman  added the comment:

Note that this only appears to be a problem under CI.

--

___
Python tracker 

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



[issue43681] doctest forgets previous imports

2021-03-31 Thread Ethan Furman


New submission from Ethan Furman :

In the Python 3.10 Doc/library/enum.rst file was the following:

.. class:: FlagBoundary

   *FlagBoundary* controls how out-of-range values are handled in *Flag* and its
   subclasses.

   .. attribute:: STRICT

  Out-of-range values cause a :exc:`ValueError` to be raised.  This is the
  default for :class:`Flag`::

 >>> from enum import STRICT
 >>> class StrictFlag(Flag, boundary=STRICT):
 ... RED = auto()
 ... GREEN = auto()
 ... BLUE = auto()
 >>> StrictFlag(2**2 + 2**4)
 Traceback (most recent call last):
 ...
 ValueError: StrictFlag: invalid value: 20
 given 0b0 10100
   allowed 0b0 00111

   .. attribute:: CONFORM

  Out-of-range values have invalid values removed, leaving a valid *Flag*
  value::

 >>> from enum import CONFORM
 >>> class ConformFlag(Flag, boundary=CONFORM):
 ... RED = auto()
 ... GREEN = auto()
 ... BLUE = auto()
 >>> ConformFlag(2**2 + 2**4)
 ConformFlag.BLUE

   .. attribute:: EJECT

  Out-of-range values lose their *Flag* membership and revert to 
:class:`int`.
  This is the default for :class:`IntFlag`::

 >>> from enum import EJECT
 >>> class EjectFlag(Flag, boundary=EJECT):
 ... RED = auto()
 ... GREEN = auto()
 ... BLUE = auto()
 >>> EjectFlag(2**2 + 2**4)
 20

   .. attribute:: KEEP

  Out-of-range values are kept, and the *Flag* membership is kept.  This is
  used for some stdlib flags:

 >>> from enum import KEEP
 >>> class KeepFlag(Flag, boundary=KEEP):
 ... RED = auto()
 ... GREEN = auto()
 ... BLUE = auto()
 >>> KeepFlag(2**2 + 2**4)
 KeepFlag.BLUE|0x10


All four tests are relying on a previous `from enum import Flag`, but only the 
three tests pass -- the fourth raises:

Traceback (most recent call last):
  File "/home/runner/work/cpython/cpython/Lib/doctest.py", line 1337, in 
__run
exec(compile(example.source, filename, "single",
  File "", line 1, in 
class KeepFlag(Flag, boundary=KEEP):
NameError: name 'Flag' is not defined

--
components: Library (Lib)
messages: 389903
nosy: ethan.furman
priority: normal
severity: normal
stage: test needed
status: open
title: doctest forgets previous imports
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-03-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

OpenWrapper was added in ce3a72aec6eaa0293c397c8d0407f7afe0072b2f (issue1267) 
and was only used to set __builtin__.open (I suppose that at thet moment 
dumbdbm.py still set open as a class attribute).

It is still can be set as a class attribute in user code, so I think that 
removing OpenWrapper needs a deprecated period.

--
nosy: +christian.heimes, gvanrossum

___
Python tracker 

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



[issue43659] AIX: test_curses crashes buildbot

2021-03-31 Thread Michael Felt


Michael Felt  added the comment:

FYI: from a core dump - top of where is:

Segmentation fault in winsnstr at 0xd3ebc050
0xd3ebc050 (winsnstr+0x190) a4190002   lhzu   r0,0x2(r25)
(dbx) where
winsnstr(??, ??, ??) at 0xd3ebc050
unnamed block in IPRA.$_curses_window_insstr_impl(self = 0x100fd954, 
group_left_1 = -739652824, y = 804382672, x = 804382676, str = 0x2ff1e7dc, 
group_right_1 = -739620304, attr = 0), line 1855 in "_cursesmodule.c"
IPRA.$_curses_window_insstr_impl(self = 0x100fd954, group_left_1 = -739652824, 
y = 804382672, x = 804382676, str = 0x2ff1e7dc, group_right_1 = -739620304, 
attr = 0), line 1855 in "_cursesmodule.c"
_curses_window_insstr(self = 0x100a96ec, args = 0x20088288), line 1160 in 
"_cursesmodule.c.h"
cfunction_call(func = 0x305337d0, args = 0x20088288, kwargs = 0x2ff1e8b0), line 
567 in "methodobject.c"
_PyObject_MakeTpCall(tstate = (nil), callable = 0x20088288, args = 0x2ff1e930, 
nargs = 131, keywords = 0x10167b48), line 215 in "call.c"
_PyEval_EvalFrameDefault(tstate = 0x100b2a6c, f = 0x303a1268, throwflag = 
806335952), line 1429 in "abstract.h"
_PyEval_Vector(tstate = 0x100ef278, con = 0x300fd59a, locals = 0x2ff1ea90, args 
= 0x20045994, argcount = 806339296, kwnames = 0x300ff6a0), line 46 in 
"pycore_ceval.h"

--

___
Python tracker 

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



[issue43678] TypeError: get() got an unexpected keyword argument 'vars'

2021-03-31 Thread Eric V. Smith


New submission from Eric V. Smith :

Please provide example code that we can run which demonstrates the problem.

--
nosy: +eric.smith

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-03-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

As for dbm.dumb, it was an attempt to make _Database._commit() working at the 
shutdown stage (it is indirectly called from __del__()). See issue723231. 
Although in Python 2 __builtin__.open != io.open, and in Python 3.0 the code 
already uses io.open directly.

I afraid that this code is not reliable (and never was reliable), because 
modules os and io can be cleared before calling it, so os.unlink and io.open 
would not work. But this is a different issue.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue4111] Add Systemtap/DTrace probes

2021-03-31 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991
nosy_count: 25.0 -> 26.0
pull_requests: +23859
pull_request: https://github.com/python/cpython/pull/25115

___
Python tracker 

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



[issue43677] Descriptor.rst - Reference to Py_MethodType is not up to date

2021-03-31 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think it's PyMethod_Type.

--
nosy: +eric.smith, rhettinger

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

I also opened a discussion on python-dev about OpenWrapper and staticmethod:
https://mail.python.org/archives/list/python-...@python.org/thread/QZ7SFW3IW3S2C5RMRJZOOUFSHHUINNME/

--

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-03-31 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +methane

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-03-31 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue43680] Remove undocumented io.OpenWrapper and _pyio.OpenWrapper

2021-03-31 Thread STINNER Victor


New submission from STINNER Victor :

The OpenWrapper function of io and _pyio is an undocumented hack allowing to 
use the builtin open() function as a method:

class MyClass:
method = open

MyClass.method(...)# class method
MyClass().method(...)  # instance method

It is only needed by the _pyio module: the pure Python implementation of the io 
module:
---
class DocDescriptor:
"""Helper for builtins.open.__doc__
"""
def __get__(self, obj, typ=None):
return (
"open(file, mode='r', buffering=-1, encoding=None, "
 "errors=None, newline=None, closefd=True)\n\n" +
open.__doc__)

class OpenWrapper:
"""Wrapper for builtins.open

Trick so that open won't become a bound method when stored
as a class variable (as dbm.dumb does).

See initstdio() in Python/pylifecycle.c.
"""
__doc__ = DocDescriptor()

def __new__(cls, *args, **kwargs):
return open(*args, **kwargs)
---

The io module simply uses an alias to open:
---
OpenWrapper = _io.open # for compatibility with _pyio
---

No wrapper is needed since built-in functions can be used directly as methods. 
Example:
---
class MyClass:
method = len  # built-in function

print(MyClass.method("abc"))
print(MyClass().method("abc"))
---

This example works as expected, it displays "3" two times.


I propose to simply remove io.OpenWrapper and force developers to explicitly 
use staticmethod:

class MyClass:
method = staticmethod(open)

io.OpenWrapper is not documented.

I don't understand the remark about dbm.dumb: I fail to see where the built-in 
open() function is used as a method.

--
components: Library (Lib)
messages: 389896
nosy: vstinner
priority: normal
severity: normal
status: open
title: Remove undocumented io.OpenWrapper and _pyio.OpenWrapper
versions: Python 3.10

___
Python tracker 

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



[issue43674] strange effect at recursion limit

2021-03-31 Thread TW


TW  added the comment:

Eryk, thanks much for your detailled and clear explaining!

Can confirm that using os.write makes it raise the RecursionError where I 
expected it to be. Also print() raising the RecursionError explains the 
behaviour I have seen.

Sadly, this also shows that handling RecursionError is not as easy as one would 
wish it to be, because the usual place for the exception handler is still too 
close to it triggering (again) and every other usually harmless call could also 
trigger it on that level.

So maybe a better solution is voluntarily stopping recursion at a safe distance 
from the recursion limit (== not going deeper, avoiding the exception).

Or doing some tricky construction of first going upwards to a safe distance 
from the limit when handling this exception.

--

___
Python tracker 

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



[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2021-03-31 Thread Martin


Martin  added the comment:

pdb uses vanilla repr as well:

https://github.com/python/cpython/blob/f3ab670fea75ebe177e3412a5ebe39263cd428e3/Lib/pdb.py#L1180

--

___
Python tracker 

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



[issue43679] ttk.Sizegrip disappears under Windows 10 UI Scaling, with dpiAware set true and >1 scaling

2021-03-31 Thread MikeS


New submission from MikeS :

When using tkinter on Windows (10) with a >1 HiDpi screen the sizegrip 
disappear with dpiawareness is on. A minimal example is as follows:

import tkinter as tk
import tkinter.ttk as ttk
from ctypes import windll, pointer, wintypes
windll.shcore.SetProcessDpiAwareness(1)

root = tk.Tk()
btn1 = tk.Button(root, text='btn1').pack(side=tk.LEFT)
sg = ttk.Sizegrip(root).pack(side=tk.LEFT)
btn2 = tk.Button(root, text='btn2').pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
root.mainloop()

Works fine with commented "SetProcessDpiAwareness", but not when using it. This 
might be related to the tk issues with hidpi and small radio/checkboxes 
https://bugs.python.org/issue41969

--
components: Tkinter
messages: 389893
nosy: msmith
priority: normal
severity: normal
status: open
title: ttk.Sizegrip disappears under Windows 10 UI Scaling, with dpiAware set 
true and >1 scaling
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue37945] [Windows] test_locale.TestMiscellaneous.test_getsetlocale_issue1813() fails

2021-03-31 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, the initial issue has been fixed: test_locale pass again on Windows.

Let's continue the discussion on getlocale() in bpo-43557 "Deprecate 
getdefaultlocale(), getlocale() and normalize() functions" ;-)

--
priority: release blocker -> 
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



  1   2   >