[issue42251] Add threading.gettrace and threading.getprofile

2020-11-04 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue42251] Add threading.gettrace and threading.getprofile

2020-11-04 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 0001a1b69ecda47b0406daa88c2943877580bcae by Mario Corchero in 
branch 'master':
bpo-42251: Add gettrace and getprofile to threading (GH-23125)
https://github.com/python/cpython/commit/0001a1b69ecda47b0406daa88c2943877580bcae


--
nosy: +pablogsal

___
Python tracker 

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



[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 3529718925f40d14ed48d281d809187bc7314a14 by Victor Stinner in 
branch 'master':
bpo-42236: os.device_encoding() respects UTF-8 Mode (GH-23119)
https://github.com/python/cpython/commit/3529718925f40d14ed48d281d809187bc7314a14


--

___
Python tracker 

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



[issue42236] os.device_encoding() doesn't respect the UTF-8 Mode

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:

> But locale encoding and console cp are different on Windows. Users may want 
> to know console cp even when they want to use UTF-8 by default for 
> reading/writing text files.

You're right. My final change leaves Windows unchanged.

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



[issue4683] tests missing in urllib2

2020-11-04 Thread Irit Katriel


Change by Irit Katriel :


--
components: +Tests
resolution: fixed -> 
title: urllib2.HTTPDigestAuthHandler fails on third hostname? -> tests missing 
in urllib2
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.6

___
Python tracker 

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



[issue42258] argparse: show choices once per argument

2020-11-04 Thread mendelmaleh


Change by mendelmaleh :


--
components: Library (Lib)
nosy: mendelmaleh
priority: normal
severity: normal
status: open
title: argparse: show choices once per argument
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



[issue4225] unicode_literals doesn't work in exec

2020-11-04 Thread Roundup Robot


Change by Roundup Robot :


--
nosy: +python-dev
nosy_count: 3.0 -> 4.0
pull_requests: +22055
pull_request: https://github.com/python/cpython/pull/23143

___
Python tracker 

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



[issue5038] urrlib2/httplib doesn't reset file position between requests

2020-11-04 Thread Irit Katriel


Change by Irit Katriel :


--
components: +Documentation
stage: patch review -> needs patch
versions: +Python 3.10, Python 3.9 -Python 2.6

___
Python tracker 

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



[issue1767511] SocketServer.DatagramRequestHandler with empty response

2020-11-04 Thread Irit Katriel


Change by Irit Katriel :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
stage: patch review -> needs patch
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.6

___
Python tracker 

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



[issue42259] pprint: infinite recursion for saferepr() when using nested objects, but str() works

2020-11-04 Thread Danylo Hlynskyi


New submission from Danylo Hlynskyi :

First, here's an example using str():

```
class NiceObject:
def __str__(self):
return str(self.__dict__)
def __repr__(self):
return str(self)

s = NiceObject()
s.self = s
```
This outputs:
```
>>> s
{'self': {...}}
```

When I replace str() call with pprint.saferepr(), I end up in infinite 
recursion.
```
import pprint

class ReallyNiceObject:
def __str__(self):
return pprint.saferepr(self.__dict__)
def __repr__(self):
return str(self)
```

Same happens for pprint.pformat(), with depth set.

Is this expected behavior?

--
components: Library (Lib)
messages: 380315
nosy: danbst
priority: normal
severity: normal
status: open
title: pprint: infinite recursion for saferepr() when using nested objects, but 
str() works
type: behavior
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



[issue42258] argparse: show choices once per argument

2020-11-04 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 1.0 -> 2.0
pull_requests: +22056
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/23143

___
Python tracker 

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



[issue41832] PyType_FromSpec() should accept tp_doc=NULL

2020-11-04 Thread hai shi


hai shi  added the comment:

> If you change this, why do it only for tp_doc, but for all the slots? NULL 
> should *always* mean that the slot is set to NULL instead of inherited. 
> (Except maybe in cases where this is dangerous; then it should result in an 
> error?

IMO, it's a proper user case.
>From bpo-26978: "I'll also try making an explicit `{Py_tp_dealloc, NULL}` 
>override the inherited value, as per Serhiy's suggestion."
Petr, do you have a PR about it?

> If you want to only change this for tp_doc, please also update the 
> PyType_Slot documentation to cover the exception.

Copy that, I will update it soon.

--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 8021875bbcf7385e651def51bc597472a569042c by Victor Stinner in 
branch 'master':
bpo-1635741: Add PyModule_AddObjectRef() function (GH-23122)
https://github.com/python/cpython/commit/8021875bbcf7385e651def51bc597472a569042c


--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:

I added a new PyModule_AddObjectRef() function which does not steal a reference 
to the value on success. I suggest to use this new function instead of 
PyModule_AddObject() which is usually misused (creating reference leaks).

--

___
Python tracker 

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



[issue42249] Plistlib cannot create binary Plist file larger than 4GiB

2020-11-04 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue41944] [security][CVE-2020-27619] Python testsuite calls eval() on content received via HTTP

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:

Red Hat advisory: https://access.redhat.com/security/cve/CVE-2020-27619

--

___
Python tracker 

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



[issue41944] [security][CVE-2020-27619] Python testsuite calls eval() on content received via HTTP

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:

The CVE-2020-27619 has been assigned to this issue.

--
title: [security] Python testsuite calls eval() on content received via HTTP -> 
[security][CVE-2020-27619] Python testsuite calls eval() on content received 
via HTTP

___
Python tracker 

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



[issue35455] Solaris: thread_time doesn't work with current implementation

2020-11-04 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 72bb4c6c1fc5f5209819a2e62d55475ddc888192 by Miss Skeleton (bot) 
in branch '3.9':
bpo-35455: Fix thread_time for Solaris OS (GH-8) (GH-23130)
https://github.com/python/cpython/commit/72bb4c6c1fc5f5209819a2e62d55475ddc888192


--

___
Python tracker 

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



[issue35455] Solaris: thread_time doesn't work with current implementation

2020-11-04 Thread Jakub Kulik


Change by Jakub Kulik :


--
pull_requests: +22057
pull_request: https://github.com/python/cpython/pull/23145

___
Python tracker 

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



[issue35455] Solaris: thread_time doesn't work with current implementation

2020-11-04 Thread Jakub Kulik


Change by Jakub Kulik :


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



[issue8978] "tarfile.ReadError: file could not be opened successfully" if compiled without zlib

2020-11-04 Thread Jordan Williams


Jordan Williams  added the comment:

This issue took me a long time to diagnose when attempting to decompress a 
bzip2-compressed tarball. This occurs with Python 3.9.0. Since I was using 
asdf, which uses Pyenv internally, to build and manage my Python version, I 
failed to notice it was missing development libraries. A slightly more 
informative message could easily have tipped me off to this in short order.

--
nosy: +jwillikers
type: behavior -> crash
versions: +Python 3.9 -Python 3.3

___
Python tracker 

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



[issue40512] [subinterpreters] Meta issue: per-interpreter GIL

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-15751: "Make the PyGILState API compatible with subinterpreters".

--

___
Python tracker 

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



[issue40522] [subinterpreters] Get the current Python interpreter state from Thread Local Storage (autoTSSkey)

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-15751: "Make the PyGILState API compatible with subinterpreters".

--

___
Python tracker 

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



[issue15751] [subinterpreters] Make the PyGILState API compatible with subinterpreters

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-40522: Get the current Python interpreter state from Thread Local 
Storage (autoTSSkey).

--
versions: +Python 3.10 -Python 3.9

___
Python tracker 

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



[issue15751] [subinterpreters] Make the PyGILState API compatible with subinterpreters

2020-11-04 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22058
pull_request: https://github.com/python/cpython/pull/23146

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22059
pull_request: https://github.com/python/cpython/pull/23147

___
Python tracker 

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



[issue35455] Solaris: thread_time doesn't work with current implementation

2020-11-04 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:


New changeset a12f459ec2a31b96a21c735eb18f3d0fd19e99ff by Jakub Kulík in branch 
'3.8':
[3.8] bpo-35455: Fix thread_time for Solaris OS (GH-8). (GH-23145)
https://github.com/python/cpython/commit/a12f459ec2a31b96a21c735eb18f3d0fd19e99ff


--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +22060
pull_request: https://github.com/python/cpython/pull/23148

___
Python tracker 

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



[issue42260] [C API] Add PyInterpreterState_SetConfig(): reconfigure an interpreter

2020-11-04 Thread STINNER Victor


New submission from STINNER Victor :

This issue is a follow-up of the PEP 567 which introduced the PyConfig C API 
and is related to PEP 432 which wants to rewrite Modules/getpath.c in Python.

I would like to add a new PyInterpreterState_SetConfig() function to be able to 
reconfigure a Python interpreter in C. One example is to write a custom 
sys.path, to implement of virtual environment (common request for embedded 
Python), etc. Currently, it's really complex to tune the Python configuration.

The use case is to tune Python for embedded Python. First, I would like to add 
new functions to the C API for that:

* PyInterpreterState_GetConfigCopy()
* PyInterpreterState_SetConfig()

The second step will to be expose these two functions in Python (I'm not sure 
where for now), and gives the ablity to tune the Python configuration in pure 
Python.

The site module already does that for sys.path, but it is running "too late" in 
the Python initialization. Here the idea is to configure Python before it does 
access any file on disk, after the "core" initialization and before the "main" 
initialization.

One concrete example would be to reimplement Modules/getpath.c in Python, 
convert it to a frozen module, and run it at Python startup to populate 
sys.path. It would allow to move some of the site code into this module to run 
it earlier.

Pseudo-code in C:
-
void init_core(void)
{
  // "Core" initialization
  PyConfig config;
  PyConfig_InitPython(&config);
  PyConfig._init_main = 0
  Py_InitializeFromc(&config);
  PyConfig_Clear(&config);
}

void tune_config(void)
{
  PyConfig config;
  PyConfig_InitPython(&config);

  // Get a copy of the current configuration
  PyInterpreterState_GetConfigCopy(&config);  // <== NEW API!

  // ... put your code to tune config ...

  // dummy example, current not possible in Python
  config.bytes_warnings = 1;

  // Reconfigure Python with the updated configuration
  PyInterpreterState_SetConfig(&config);  // <=== NEW API!
  PyConfig_Clear(&config);
}
  
int main()
{
  init_core();
  tune_config(); // <=== THE USE CASE!
  _Py_InitializeMain();
  return Py_RunMain();
}
-

In this example, tune_config() is implemented in C. But later, it will be 
possible to convert the configuration to a Python dict and run Python code to 
tune the configuration.

The PEP 587 added a "Multi-Phase Initialization Private Provisional API":

* PyConfig._init_main = 0
* _Py_InitializeMain()

https://docs.python.org/dev/c-api/init_config.html#multi-phase-initialization-private-provisional-api

--
components: C API
messages: 380327
nosy: vstinner
priority: normal
severity: normal
status: open
title: [C API] Add PyInterpreterState_SetConfig(): reconfigure an interpreter
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



[issue42260] [C API] Add PyInterpreterState_SetConfig(): reconfigure an interpreter

2020-11-04 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue42260] [C API] Add PyInterpreterState_SetConfig(): reconfigure an interpreter

2020-11-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22062
pull_request: https://github.com/python/cpython/pull/23150

___
Python tracker 

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



[issue42260] [C API] Add PyInterpreterState_SetConfig(): reconfigure an interpreter

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset cfb41e80c1ac5940ec6f2246c9ab4a3d16ef757e by Victor Stinner in 
branch 'master':
bpo-42260: Reorganize PyConfig (GH-23149)
https://github.com/python/cpython/commit/cfb41e80c1ac5940ec6f2246c9ab4a3d16ef757e


--

___
Python tracker 

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



[issue42261] Windows legacy I/O mode mistakenly ignores the device encoding

2020-11-04 Thread Eryk Sun


New submission from Eryk Sun :

In Python 3.8+, legacy standard I/O mode uses the process code page from GetACP 
instead of the correct device encoding from GetConsoleCP and 
GetConsoleOutputCP. For example:

C:\>chcp 850
Active code page: 850
C:\>set PYTHONLEGACYWINDOWSSTDIO=1

C:\>py -3.7 -c "import sys; print(sys.stdin.encoding)"
cp850
C:\>py -3.8 -c "import sys; print(sys.stdin.encoding)"
cp1252
C:\>py -3.9 -c "import sys; print(sys.stdin.encoding)"
cp1252

This is based on config_init_stdio_encoding() in Python/initconfig.c, which 
sets config->stdio_encoding via config_get_locale_encoding(). Cannot 
config->stdio_encoding be set to NULL for default behavior?

Computing this ahead of time would require separate encodings 
config->stdin_encoding, config->stdout_encoding, and config->stderr_encoding. 
And _Py_device_encoding would have to be duplicated as something like 
config_get_device_encoding(PyConfig *config, int fd, wchar_t **device_encoding).

--
components: IO, Interpreter Core, Windows
messages: 380329
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Windows legacy I/O mode mistakenly ignores the device encoding
type: behavior
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



[issue42261] Windows legacy I/O mode mistakenly ignores the device encoding

2020-11-04 Thread Eryk Sun


Eryk Sun  added the comment:

There's a related issue that affects opening duplicated file descriptors and 
opening "CON", "CONIN$", and "CONOUT$" in legacy I/O mode, but this case has 
always been broken. For Windows, _Py_device_encoding needs to be generalized to 
use _get_osfhandle and GetNumberOfConsoleInputEvents to detect and 
differentiate console input and output, instead of using isatty() and hard 
coding file descriptors 0-2.

--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 988f1ec8d2643a0d00851903abcdae90d57ac0e6 by Victor Stinner in 
branch 'master':
bpo-1635741: _contextvars uses PyModule_AddType() (GH-23147)
https://github.com/python/cpython/commit/988f1ec8d2643a0d00851903abcdae90d57ac0e6


--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 18ce7f1d0a3d65f34f25c5964da588743a1bfe3c by Victor Stinner in 
branch 'master':
bpo-1635741: _ast uses PyModule_AddObjectRef() (GH-23146)
https://github.com/python/cpython/commit/18ce7f1d0a3d65f34f25c5964da588743a1bfe3c


--

___
Python tracker 

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



[issue42261] Windows legacy I/O mode mistakenly ignores the device encoding

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:

> This is based on config_init_stdio_encoding() in Python/initconfig.c, which 
> sets config->stdio_encoding via config_get_locale_encoding(). Cannot 
> config->stdio_encoding be set to NULL for default behavior?

I would like to get a PyConfig structure fully populated to make the Python 
initialization more deterministic and reliable. So PyConfig fully control used 
encodings.

The solution here is to fix config_init_stdio_encoding() to use GetConsoleCP() 
and GetConsoleOutputCP() to build a "cpXXX" string.

This issue seems to be a regression that I introduced in Python 3.8 with the 
PEP 587 (PyConfig). I didn't notice this subtle case during my refactoring. 
Relying on os.device_encoding() when the encoding is NULL is not obvious. 
That's why I prefer to get PyConfig full populated ;-)

It would be nice to get an unit test for this case.

--
nosy: +vstinner

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22063
pull_request: https://github.com/python/cpython/pull/23151

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread Christian Heimes


Change by Christian Heimes :


--
nosy:  -christian.heimes

___
Python tracker 

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



[issue25573] FrameSummary repr() does not support previously working uses of repr in traceback module

2020-11-04 Thread Irit Katriel


Irit Katriel  added the comment:

I think the fourth element (the code line) was omitted from repr because it is 
not one of the constructor args for FrameSummary (it is derived from them), so 
it's redundant in terms of describing this instance.

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue42261] Windows legacy I/O mode mistakenly ignores the device encoding

2020-11-04 Thread Eryk Sun


Eryk Sun  added the comment:

> The solution here is to fix config_init_stdio_encoding() to use 
> GetConsoleCP() and GetConsoleOutputCP() to build a "cpXXX" string.

But, as I mentioned, that's only possible by replacing config->stdio_encoding 
with three separate settings: config->stdin_encoding, config->stdout_encoding, 
and config->stderr_encoding.

--

___
Python tracker 

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



[issue30384] traceback.TracebackException.format shouldn't format_exc_only() when __traceback__ is None

2020-11-04 Thread Irit Katriel


Irit Katriel  added the comment:

Setting __traceback__ to None is not going to make the exception disappear.  
Note that TracebackException does not represent a traceback, it represent an 
exception (for rendering in tracebacks). So all information of the exception is 
rendered by TracebackException.format(), not only the exception's traceback.

It's not entirely clear to me what you are trying to do (what is the output you 
are hoping to get?) but this looks more like a question than a bug report, so I 
am closing this issue. If this is still relevant, I'd suggest you ask on the 
python users list or StackOverflow - you are more likely to receive a prompt 
response there.

--
nosy: +iritkatriel
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



[issue42262] [C API] Add Py_NewRef() function to get a new strong reference to an object

2020-11-04 Thread STINNER Victor


New submission from STINNER Victor :

In C, the following pattern (A) is very common:

Py_INCREF(sysdict);
interp->sysdict = sysdict;

* (1) Increment the reference counter
* (2) Store a reference to the object somewhere

Similar pattern (B) using return:

Py_INCREF(temp);
return temp;

The problem in these patterns is that the object has to be written twice. I 
propose to add a simple new Py_NewRef() function which returns a new strong 
reference. In short, it's just:

static inline PyObject* Py_NewRef(PyObject *obj)
{
Py_INCREF(obj);
return obj;
}

(The actual implementation is just a little bit more complex, to also export it 
as a regular function.)

Pattern (A) becomes:

interp->sysdict = Py_NewRef(sysdict);

Pattern (B) becomes:


return Py_NewRef(temp);

Py_NewRef() might help to prepare a C extension to be converted to HPy which 
uses a HPy_Dup() function. HPy_Dup() is different than "Py_INCREF(obj), obj" 
for subtle reasons. I let you dig into HPy documentation for the rationale:

https://hpy.readthedocs.io/en/latest/api.html#handles

Even if you ignore HPy, Py_NewRef() avoids to repeat the object variable, and 
so makes the code simpler. Simple example:

-#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
+#define Py_RETURN_NONE return Py_NewRef(Py_None)

--
components: C API
messages: 380337
nosy: vstinner
priority: normal
severity: normal
status: open
title: [C API] Add Py_NewRef() function to get a new strong reference to an 
object
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



[issue14655] traceback module docs should show how to print/fomat an exception object

2020-11-04 Thread Irit Katriel


Irit Katriel  added the comment:

As of 3.5 there is this option:

traceback.TracebackException.from_exception(exc).format()


Perhaps that can be mentioned in the doc for traceback.format_exception().

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, iritkatriel
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 2.7, Python 3.2, Python 
3.3

___
Python tracker 

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



[issue42262] [C API] Add Py_NewRef() function to get a new strong reference to an object

2020-11-04 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue42262] [C API] Add Py_NewRef() function to get a new strong reference to an object

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:

> The problem in these patterns is that the object has to be written twice.

I'm talking about the variable name which has to be repeated (written twice) in 
the source code.

--

___
Python tracker 

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



[issue42262] [C API] Add Py_NewRef() function to get a new strong reference to an object

2020-11-04 Thread Simon Cross


Change by Simon Cross :


--
nosy: +hodgestar

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 58ca33b4674f39189b03c9a39fa7b676b43b3d08 by Victor Stinner in 
branch 'master':
bpo-1635741: Fix ref leak in _PyWarnings_Init() error path (GH-23151)
https://github.com/python/cpython/commit/58ca33b4674f39189b03c9a39fa7b676b43b3d08


--

___
Python tracker 

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



[issue12535] Chained tracebacks are confusing because the first traceback is minimal

2020-11-04 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.9 -Python 3.4

___
Python tracker 

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



[issue42260] [C API] Add PyInterpreterState_SetConfig(): reconfigure an interpreter

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset af1d64d9f7a7cf673279725fdbaf4adcca51d41f by Victor Stinner in 
branch 'master':
bpo-42260: Main init modify sys.flags in-place (GH-23150)
https://github.com/python/cpython/commit/af1d64d9f7a7cf673279725fdbaf4adcca51d41f


--

___
Python tracker 

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



[issue16855] traceback module leaves off module name in last line of formatted tracebacks

2020-11-04 Thread Irit Katriel


Irit Katriel  added the comment:

This is a python 2 only issue.

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue42261] Windows legacy I/O mode mistakenly ignores the device encoding

2020-11-04 Thread Eryk Sun


Eryk Sun  added the comment:

> It would be nice to get an unit test for this case.

The process code page from GetACP() is either an ANSI code page or CP_UTF8 
(65001). It should never be a Western OEM code page such as 850. In that case, 
a reliable unit test would check that the configured encoding is a particular 
OEM code page. For example, spawn a new interpreter in a windowless console 
session (i.e. creationflags=CREATE_NO_WINDOW). Set the session's input code 
page to 850 via ctypes.WinDLL('kernel32').SetConsoleCP(850). Set 
os.environ['PYTHONLEGACYWINDOWSSTDIO'] = '1'. Then spawn [sys.executable, '-c', 
'import sys; print(sys.stdin.encoding)'], and verify that the output is 'cp850'.

--

___
Python tracker 

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



[issue19206] Support disabling file I/O when doing traceback formatting

2020-11-04 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue40747] sysconfig.get_config_var("py_version_nodot") should return 3_10

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:

Links about the "AssertionError: would build wheel with unsupported tag 
('cp310', 'cp310', 'linux_x86_64')" error:

* PEP 641 -- Using an underscore in the version portion of Python 3.10 
compatibility tags
  https://www.python.org/dev/peps/pep-0641/
* PEP 641 discussion:
  
https://discuss.python.org/t/pep-641-using-an-underscore-in-the-version-portion-of-python-3-10-compatibility-tags/5513
* CPython PR 20333: "bpo-40747: Make py_version_nodot 3_10 not 310"
  https://github.com/python/cpython/pull/20333
* wheel: "Fails to build wheel for Python 3.10"
  https://github.com/pypa/wheel/issues/354
* python3-setuptools: "python-setuptools fails to build with Python 3.10: 
AssertionError: would build wheel with unsupported tag ('cp310', 'cp310', 
'linux_x86_64')"
https://bugzilla.redhat.com/show_bug.cgi?id=1891840

--
nosy: +vstinner

___
Python tracker 

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



[issue42252] Embeddable Python indicates that it uses PYTHONPATH

2020-11-04 Thread Steve Dower


Steve Dower  added the comment:

> I'd been expecting this was commonly used as the way to give access to 
> python3X.dll.

Yeah, both. The idea is to delete the files you don't want - so if you don't 
need python.exe, just don't include it. Same goes for some of the native 
modules (e.g. deleting _socket.pyd and _ssl.pyd are an easy way to make sure 
you aren't offering networking).

> I've been mostly focusing on `PYTHONPATH` because that's where I encountered 
> the issue. Which if any of the other env variables are respected? 

It's the equivalent of passing -I. That's the flag that gets set when a ._pth 
is detected: PC/getpathp.c#L563

> Would there be an argument to add additional command line options that could 
> be used as a more secure alternative to the env variables? ... Maybe this 
> doesn't make sense since you said it is the ._pth that causes this...just 
> thinking aloud.

Yeah, the ._pth file is the more secure alternative. To change the import 
search path, an attacker has to be able to modify a (likely admin-only) file on 
disk, rather than just launching an executable with a specific command line. 
(For a bit more context, many exploits try to schedule tasks, which allows 
arbitrary executable path and arguments. So anything resembling a security 
feature can't be allowed to be overridden by environment or arguments.)

> The two options you mention (modify ._pth and append to sys.path) aren't 
> great because we 1) would prefer to use the un-modified python distro 2) 
> don't own the scripts that we are embedding, they are from a 3rd party so 
> modifications are complicated.

None of the other options are better :)

Overriding the ._pth file should just be a matter of replacing the file. It's 
deliberately relative to its location, which means it should almost always be 
static. If you need your embedded interpreter to pick up paths from the local 
environment, just delete the file instead of updating it (which will make your 
copy of Python exploitable, but that's the tradeoff).

I don't know what your particular scripts look like, but I've had to go through 
and modify a number of third-party packages to make them work with this kind of 
setup. It's certainly possible to work around the limitation in a number of 
ways, often transparently to the code that's eventually going to be executed - 
the runpy module is often helpful. (And yeah, an attacker could do it as well, 
just not as trivially as it would be without the restriction.)

--

___
Python tracker 

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



[issue1346874] httplib simply ignores CONTINUE

2020-11-04 Thread Mattias Amnefelt


Change by Mattias Amnefelt :


--
nosy: +Mattias Amnefelt

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7184218e186811e75be663be78e57d5302bf8af6 by Mohamed Koubaa in 
branch 'master':
bpo-1635741: Fix PyInit_pyexpat() error handling (GH-22489)
https://github.com/python/cpython/commit/7184218e186811e75be663be78e57d5302bf8af6


--

___
Python tracker 

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



[issue1514420] Traceback display code can attempt to open a file named ""

2020-11-04 Thread Irit Katriel


Irit Katriel  added the comment:

I was able to reproduce it on 3.8, but I'm confused about where the open is 
happening because linecache.updatecache tries to avoid this:

if not filename or (filename.startswith('<') and filename.endswith('>')):
return []

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.8, 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



[issue23915] [doc] traceback set with BaseException.with_traceback() pushed back on raise

2020-11-04 Thread Irit Katriel


Change by Irit Katriel :


--
title: traceback set with BaseException.with_traceback() overwritten on raise 
-> [doc] traceback set with BaseException.with_traceback() pushed back on raise
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.4, Python 3.5

___
Python tracker 

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



[issue42262] [C API] Add Py_NewRef() function to get a new strong reference to an object

2020-11-04 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue11007] stack tracebacks should give the relevant class name

2020-11-04 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10 -Python 3.7

___
Python tracker 

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



[issue42237] test_socket.SendfileUsingSendfileTest fails on illumos

2020-11-04 Thread Jakub Stasiak


Jakub Stasiak  added the comment:

I thought I'd give it a shot and I believe i found the issue. Let's use the 
testCount test as an example.

The client side (or the data sending side) looks like this:

def _testCount(self):
address = self.serv.getsockname()
file = open(os_helper.TESTFN, 'rb')
sock = socket.create_connection(address,
timeout=support.LOOPBACK_TIMEOUT)
with sock, file:
count = 507
meth = self.meth_from_sock(sock)
sent = meth(file, count=count)
self.assertEqual(sent, count)
self.assertEqual(file.tell(), count)

So we're sending 507 bytes of data at once to a socket that has a timeout 
of 5.0 seconds set (default in those tests).

Somewhere along the way socket._sendfile_use_sendfile() is called and in it 
there's a loop:

try:
while True:
(...)
try:
sent = os_sendfile(sockno, fileno, offset, blocksize)
except BlockingIOError:
if not timeout:
# Block until the socket is ready to send some
# data; avoids hogging CPU resources.
selector_select()
continue
(...)
return total_sent

On my test VM running openindiana 5.11 (I think that's the version number?) 
this is basically an infinite loop (I think it'll end at some point, but I 
didn't have the patience to verify this). That's because trying to send 507 
bytes to that socket with 5 seconds timeout will trigger BlockingIOError. Why?

This is the relevant part of os.sendfile() implementation from posixmodule.c:

do {
Py_BEGIN_ALLOW_THREADS
ret = sendfile(out_fd, in_fd, &offset, count);
Py_END_ALLOW_THREADS
} while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
if (ret < 0)
return (!async_err) ? posix_error() : NULL;
return Py_BuildValue("n", ret);


offset is 0 in our case, but its exact value doesn't matter. The trouble is 
this is what illumos sendfile man page[1] says:


RETURN VALUES

   (...) In some error cases sendfile() may still write some
   data before encountering an error and returning -1.  When that occurs,
   off is updated to point to the byte that follows the last byte copied and
   should be compared with its value before calling sendfile() to determine
   how much data was sent.

After some input from Jakub Kulik I believe this is a unique behavior (Linux, 
Oracle Solaris, Mac OS, FreeBSD and likely all or almost all other OSes don't 
do this) and it lacks handling on the Python side.

I tested this and indeed the sendfile(out_fd, in_fd, &offset, count) call 
*does* do partial writes in our case which gets reported as EAGAIN which gets 
converted to BlockingIOError which makes socket._sendfile_use_sendfile() retry 
again and again, each time resending the very beginning of the data and not 
going any further, therefore accumulating a lot of garbage on the receiving 
socket's side.

This patch works for me and I run the whole test_socket test suite with it, no 
more failures:

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 203f98515dfd..eeff11b5b8ea 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -9475,13 +9475,20 @@ os_sendfile_impl(PyObject *module, int out_fd, int 
in_fd, PyObject *offobj,
}
#endif

+off_t original_offset = offset;
do {
Py_BEGIN_ALLOW_THREADS
ret = sendfile(out_fd, in_fd, &offset, count);
Py_END_ALLOW_THREADS
} while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
-if (ret < 0)
-return (!async_err) ? posix_error() : NULL;
+if (ret < 0) {
+   if (offset != original_offset) {
+   ret = offset - original_offset;
+   }
+   else {
+   return (!async_err) ? posix_error() : NULL;
+   }
+}
return Py_BuildValue("n", ret);
#endif
}

If it's verified to be a good change I'm happy to resubmit it in a PR with 
appropriate illumos-specific #ifndefs.


[1] https://illumos.org/man/3ext/sendfile

--
nosy: +jstasiak

___
Python tracker 

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



[issue34463] Discrepancy between traceback.print_exception and sys.__excepthook__

2020-11-04 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.10:

Running Release|Win32 interpreter...
Python 3.10.0a1+ (heads/exceptionGroup-stage1-dirty:928c211ad8, Oct 28 2020, 
14:36:37) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> raise SyntaxError("some message")
Traceback (most recent call last):
  File "", line 1, in 
SyntaxError: some message

>>> import traceback
>>> import sys
>>> sys.excepthook = traceback.print_exception
>>> raise SyntaxError("some message")
Traceback (most recent call last):
  File "", line 1, in 
  File "", line None
SyntaxError: some message

--
components: +Library (Lib) -Demos and Tools
nosy: +iritkatriel
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



[issue14379] Several traceback docs improvements

2020-11-04 Thread Irit Katriel


Irit Katriel  added the comment:

Closing this issue is out of date. Most if not all of the points mentioned have 
been resolved by now, and there is also a section on traceback objects [1] 
which is linked from the exc_info doc [2].

[1] https://docs.python.org/3/reference/datamodel.html#traceback-objects
[2] https://docs.python.org/3/library/sys.html#sys.exc_info

--
nosy: +iritkatriel
resolution:  -> out of date
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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-11-04 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 789359f47c2a744caa9a405131706099fd7ad6bd by Erlend Egeberg 
Aasland in branch 'master':
bpo-1635741: _sqlite3 uses PyModule_AddObjectRef() (GH-23148)
https://github.com/python/cpython/commit/789359f47c2a744caa9a405131706099fd7ad6bd


--

___
Python tracker 

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



[issue38197] Meaning of tracebacklimit differs between sys.tracebacklimit and traceback module

2020-11-04 Thread Irit Katriel

Irit Katriel  added the comment:

If you change your script to do
sys.tracebacklimit = abs(limit)
and run it with arg -3, then you get the output you expect:

C:\Users\User\src\cpython>python.bat x.py -3
Running Release|Win32 interpreter...
limit -3
from traceback module:
Traceback (most recent call last):
  File "C:\Users\User\src\cpython\x.py", line 14, in x3
x2()
  File "C:\Users\User\src\cpython\x.py", line 12, in x2
x1()
  File "C:\Users\User\src\cpython\x.py", line 10, in x1
1 / 0
ZeroDivisionError: division by zero

from interpreter:
Traceback (most recent call last):
  File "C:\Users\User\src\cpython\x.py", line 14, in x3
x2()
  File "C:\Users\User\src\cpython\x.py", line 12, in x2
x1()
  File "C:\Users\User\src\cpython\x.py", line 10, in x1
1 / 0
ZeroDivisionError: division by zero


The documentation for traceback mentions the possibility of using negative 
limits and their meaning:

Print up to limit stack trace entries from traceback object tb (starting from 
the caller’s frame) if limit is positive. Otherwise, print the last abs(limit) 
entries. 

https://docs.python.org/3/library/traceback.html#traceback.print_tb

--
nosy: +iritkatriel
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.7

___
Python tracker 

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2020-11-04 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +22065
pull_request: https://github.com/python/cpython/pull/23153

___
Python tracker 

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



[issue42263] Removing thread reference in thread results in leaked reference

2020-11-04 Thread Jason R. Coombs


New submission from Jason R. Coombs :

In issue37193, I'd worked on an implementation in which a thread reference 
would be removed as the thread was closing, but this led to a memory leak 
caught by the buildbots (https://bugs.python.org/issue37193#msg380172).

As I tracked down the issue in GH-23127, I discovered that removing the 
reference to the thread from within the thread triggered the reference leak 
detection.

I've distilled that behavior into its own test which fails on master:

```
cpython master $ git diff
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index e0e5406ac2..2b4924d4d0 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -443,6 +443,15 @@ def _run(self, other_ref, yet_another):
  msg=('%d references still around' %
   sys.getrefcount(weak_raising_cyclic_object(
 
+def test_remove_thread_ref_in_thread(self):
+def remove_ref():
+threads[:] = []
+
+threads = [
+threading.Thread(target=remove_ref),
+]
+threads[0].start()
+
 def test_old_threading_api(self):
 # Just a quick sanity check to make sure the old method names are
 # still present
```

Running that test with refcount checks leads to this failure:

```
cpython master $ ./python.exe Tools/scripts/run_tests.py -R 3:3 
test.test_threading -m test_remove_thread_ref_in_thread
/Users/jaraco/code/public/cpython/python.exe -u -W default -bb -E -m test -r -w 
-j 0 -u all,-largefile,-audio,-gui -R 3:3 test.test_threading -m 
test_remove_thread_ref_in_thread
Using random seed 8650903
0:00:00 load avg: 1.76 Run tests in parallel using 10 child processes
0:00:01 load avg: 1.78 [1/1/1] test.test_threading failed

== Tests result: FAILURE ==

1 test failed:
test.test_threading
0:00:01 load avg: 1.78
0:00:01 load avg: 1.78 Re-running failed tests in verbose mode
0:00:01 load avg: 1.78 Re-running test.test_threading in verbose mode
beginning 6 repetitions
123456
..
test.test_threading leaked [1, 1, 1] references, sum=3
test.test_threading leaked [3, 1, 1] memory blocks, sum=5
beginning 6 repetitions
123456
test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok

--

Ran 1 test in 0.001s

OK
.test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok

--

Ran 1 test in 0.001s

OK
.test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok

--

Ran 1 test in 0.001s

OK
.test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok

--

Ran 1 test in 0.001s

OK
.test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok

--

Ran 1 test in 0.001s

OK
.test_remove_thread_ref_in_thread (test.test_threading.ThreadTests) ... ok

--

Ran 1 test in 0.001s

OK
.
test.test_threading leaked [1, 1, 1] references, sum=3
test.test_threading leaked [1, 1, 1] memory blocks, sum=3
1 test failed again:
test.test_threading

== Tests result: FAILURE then FAILURE ==

1 test failed:
test.test_threading

1 re-run test:
test.test_threading

Total duration: 2.0 sec
Tests result: FAILURE then FAILURE
```

Is that behavior by design? Is it simply not possible to remove a reference to 
a thread from within the thread?

--
messages: 380353
nosy: jaraco
priority: normal
severity: normal
status: open
title: Removing thread reference in thread results in leaked reference
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



[issue37193] Memory leak while running TCP/UDPServer with socketserver.ThreadingMixIn

2020-11-04 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

I filed issue42263 to capture the underlying cause of the memory leak that led 
to the buildbot failures and the rollback.

--

___
Python tracker 

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



[issue38197] Meaning of tracebacklimit differs between sys.tracebacklimit and traceback module

2020-11-04 Thread Carl Friedrich Bolz-Tereick


Carl Friedrich Bolz-Tereick  added the comment:

It's still inconsistent between the two ways to get a traceback, and the 
inconsistency is not documented.

--

___
Python tracker 

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



[issue42237] test_socket.SendfileUsingSendfileTest fails on illumos

2020-11-04 Thread Sebastian Wiedenroth


Sebastian Wiedenroth  added the comment:

Excellent analysis, that's it! I've also tested your patch on SmartOS and it 
works great.

--

___
Python tracker 

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



[issue42131] [zipimport] Update zipimport to use specs

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
superseder:  -> zipimport is not PEP 3147 or PEP 488 compliant

___
Python tracker 

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



[issue42131] [zipimport] Update zipimport to use specs

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
resolution:  -> duplicate
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



[issue42263] Removing thread reference in thread results in leaked reference

2020-11-04 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Could this be a race condition?  The thread that's created in the test is not 
waited on (join), it may or may not have exited by the time the test function 
returns.

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue42237] test_socket.SendfileUsingSendfileTest fails on illumos

2020-11-04 Thread Jakub Kulik


Jakub Kulik  added the comment:

I did some further digging, and this is indeed not possible on Oracle Solaris 
(that is, sendfile() cannot write bytes and fail during the same call). We 
considered this a bug and changed/fixed it several years ago.

Manual page doesn't mention that either:
https://docs.oracle.com/cd/E88353_01/html/E37843/sendfile-3c.html

I am not sure whether Illumos will want to change this as well (probably not 
since it is mentioned in the man page as expected behavior), but either way, 
the proposed change doesn't harm Oracle Solaris because 'if (offset != 
original_offset)' can never be true.

--
nosy: +kulikjak

___
Python tracker 

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



[issue30384] traceback.TracebackException.format shouldn't format_exc_only() when __traceback__ is None

2020-11-04 Thread Aaron Meurer


Aaron Meurer  added the comment:

> It's not entirely clear to me what you are trying to do (what is the output 
> you are hoping to get?) but this looks more like a question than a bug 
> report, so I am closing this issue. If this is still relevant, I'd suggest 
> you ask on the python users list or StackOverflow - you are more likely to 
> receive a prompt response there.

If you don't understand an issue, the correct response isn't to close it 
because you don't understand it. If an issue is unclear, you should ask for 
clarification, not insult the person who opened it. 

What you described *is* the bug report. If you read even the title you would 
see that the report is that setting __traceback__ to None doesn't affect the 
printing of the exception.

--
nosy: +asmeurer

___
Python tracker 

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



[issue30384] traceback.TracebackException.format shouldn't format_exc_only() when __traceback__ is None

2020-11-04 Thread Irit Katriel


Irit Katriel  added the comment:

I had no intention to insult you and apologize if I did. I assumed that you 
forgot about this issue since you didn't chase it for 3 years, but you are 
right that I should have asked. 

I am reopening it so that you can explain the question. Since you didn't get a 
response so far, I'm probably not the only one who needs that. 

What do you mean by "completely hide an exception", and why do you think that 
setting __traceback__ to None should achieve that?

--
resolution: not a bug -> 
status: closed -> open

___
Python tracker 

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



[issue30384] traceback.TracebackException.format shouldn't format_exc_only() when __traceback__ is None

2020-11-04 Thread Irit Katriel


Change by Irit Katriel :


--
status: open -> pending

___
Python tracker 

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



[issue30384] traceback.TracebackException.format shouldn't format_exc_only() when __traceback__ is None

2020-11-04 Thread Aaron Meurer


Aaron Meurer  added the comment:

I think I found another way to achieve what I was trying to do, which is why I 
never pursued this. But I still think it's a bug.

__traceback__ = None isn't documented anywhere that I could find, so I was only 
able to deduce how it should work from reading the source code. If it is 
documented somewhere let me know.

I admit my initial report is a bit unclear. If you play with the test.py you 
can see what is going on

import traceback

try:
raise ValueError
except Exception as e:
e.__traceback__ = None
try:
raise TypeError
except:
traceback.print_exc()

produces this output:


ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "test.py", line 8, in 
raise TypeError
TypeError

My goal is to completely hide the caught exception in the traceback printed 
from the traceback module. It seems odd that it hides everything except for the 
actual ValueError.

--
status: pending -> open

___
Python tracker 

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



[issue42237] test_socket.SendfileUsingSendfileTest fails on illumos

2020-11-04 Thread Jakub Stasiak


Change by Jakub Stasiak :


--
pull_requests: +22066
pull_request: https://github.com/python/cpython/pull/23154

___
Python tracker 

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



[issue42237] test_socket.SendfileUsingSendfileTest fails on illumos

2020-11-04 Thread Jakub Stasiak


Jakub Stasiak  added the comment:

Thank you! I submitted a PR with a slightly modified patch (the comparison only 
happens on Solaris family of systems), I'd appreciate your confirmation that it 
still works (it's working for me on openindiana).

--

___
Python tracker 

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



[issue42264] Deprecate or remove sqlite3.OptimizedUnicode

2020-11-04 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

Ref. discussion on GH-23148: 
https://github.com/python/cpython/pull/23148#discussion_r517536083

OptimizedUnicode was obsoleted and undocumented in Python 3.3 (see commit 
86dc732f1f).

Suggesting to either deprecate OptimizedUnicode in 3.10 and remove it in 3.11, 
or just simply remove it in 3.10.

Relevant history:
48b13f0427 (undoc)
bc35bebb45 (clean up and undoc, closing bpo-13921)

(Pablo, adding you to nosy since you're the release manager; hope that's ok)

--
components: Library (Lib)
messages: 380363
nosy: berker.peksag, erlendaasland, pablogsal, vstinner
priority: normal
severity: normal
status: open
title: Deprecate or remove sqlite3.OptimizedUnicode
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



[issue30384] traceback.TracebackException.format shouldn't format_exc_only() when __traceback__ is None

2020-11-04 Thread Irit Katriel


Irit Katriel  added the comment:

The traceback is only one part of an exception. It is simply a list of frames 
that show where the exception travelled between being raised and being caught.

An exception contains information about an error, including the type of the 
exception, sometimes some parameters like an exception message, and sometimes a 
traceback.

When exception is just created and before it is ever raised, its traceback is 
None. But you can still print the rest of the information in it (its type and 
args). 

I guess you're saying that the __context__ exception of the TypeError in your 
example has an empty traceback, which means it was never raised, which doesn't 
make sense because then how did it end up being the __context__ of another 
exception?

Yeah, __context__ is in a funny state, and the traceback module doesn't try to 
inspect it and interpret what you may have meant by doing that, it just prints 
the exception like it prints any other exception and you get a funny output.

I still don't a bug.

--

___
Python tracker 

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



[issue42265] Remove binhex module following PEP-594

2020-11-04 Thread Anatoliy Platonov


New submission from Anatoliy Platonov :

https://www.python.org/dev/peps/pep-0594/#id163

--
components: Library (Lib), Tests
messages: 380365
nosy: p4m-dev
priority: normal
severity: normal
status: open
title: Remove binhex module following PEP-594
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



[issue26216] run runtktests.py error when test tkinter

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue26205] Better specify number of nested scopes

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue26137] [idea] use the Microsoft Antimalware Scan Interface

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue26153] PyImport_GetModuleDict: no module dictionary! when `__del__` triggers a warning

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue26031] Add stat caching option to pathlib

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue26300] "unpacked" bytecode

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue26285] Garbage collection of unused input sections from CPython binaries

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue26388] Disabling changing sys.argv[0] with runpy.run_module(...alter_sys=True)

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue26584] pyclbr module needs to be more flexible on loader support

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue26394] Have argparse provide ability to require a fallback value be present

2020-11-04 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue30384] traceback.TracebackException.format shouldn't format_exc_only() when __traceback__ is None

2020-11-04 Thread Aaron Meurer


Aaron Meurer  added the comment:

I don't think it's helpful to make such a literalistic interpretation. Just 
because the variable is called "traceback" doesn't mean it should apply only to 
the things that are *technically* a traceback (and I don't agree anyway that 
the line containing the exception isn't part of the "traceback").

> I guess you're saying that the __context__ exception of the TypeError in your 
> example has an empty traceback, which means it was never raised

Does it mean that? Again, __traceback__ isn't documented anywhere, so I don't 
know what it being None really means.

All I know is that it apparently disables the printing of tracebacks in the 
traceback module, but fails to omit the exception line itself, leading to an 
unreadable traceback in my example.

--

___
Python tracker 

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



[issue26031] Add stat caching option to pathlib

2020-11-04 Thread Guido van Rossum


Guido van Rossum  added the comment:

Okay, I am giving up on this.

--
resolution:  -> out of date
stage: test needed -> 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



[issue42265] Remove binhex module following PEP-594

2020-11-04 Thread Eric V. Smith


Eric V. Smith  added the comment:

PEP 594 hasn't been accepted yet.

--
nosy: +eric.smith

___
Python tracker 

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



[issue30384] traceback.TracebackException.format shouldn't format_exc_only() when __traceback__ is None

2020-11-04 Thread Irit Katriel


Irit Katriel  added the comment:

__traceback__  doesn't disable printing tracebacks.  It *is* the traceback. By 
setting it to None you erased the exception's traceback.

--

___
Python tracker 

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



[issue42266] LOAD_ATTR cache does not fully replicate PyObject_GetAttr behavior

2020-11-04 Thread Kevin Modzelewski


New submission from Kevin Modzelewski :

The problem is that the descriptor-ness of a type-level attribute is only 
checked at opcache-set time, not at opcache-hit time.

$ python3.8 test.py
2

$ ./python --version
Python 3.10.0a2+
$ git rev-parse --short HEAD
789359f47c
$ ./python test.py
1

--
components: Interpreter Core
files: test.py
messages: 380370
nosy: Kevin Modzelewski, pablogsal
priority: normal
severity: normal
status: open
title: LOAD_ATTR cache does not fully replicate PyObject_GetAttr behavior
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file49568/test.py

___
Python tracker 

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



  1   2   >