[issue40113] Turtle demo

2020-04-01 Thread Davide Golinelli


Davide Golinelli  added the comment:

you're absolutely right! 
I'm so sorry for wasting your time.

thanks and regards

--

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-04-01 Thread Petr Viktorin


Petr Viktorin  added the comment:

Definitely!

--

___
Python tracker 

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



[issue40121] socket module missing audit events

2020-04-01 Thread Steve Dower


Change by Steve Dower :


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



[issue40121] socket module missing audit events

2020-04-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18631
pull_request: https://github.com/python/cpython/pull/19275

___
Python tracker 

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



[issue40121] socket module missing audit events

2020-04-01 Thread Steve Dower


Steve Dower  added the comment:


New changeset 3ef4a7e5a7c29e17d5152d1fa6ceeb1fee269699 by Steve Dower in branch 
'master':
bpo-40121: Fix exception type in test (GH-19267)
https://github.com/python/cpython/commit/3ef4a7e5a7c29e17d5152d1fa6ceeb1fee269699


--

___
Python tracker 

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



[issue40132] Mechanism to control who owns package names on PyPI?

2020-04-01 Thread ChrisRands


New submission from ChrisRands :

Not sure if this is the right place to mention this (apologies if not). 
Naturally, package names are unique so when you run `pip install package-name` 
there is no ambiguity. However, this means that package names are limited and 
potentially valuable. Already there were some malicious users typo squatting 
famous package names (https://www.nbu.gov.sk/skcsirt-sa-20170909-pypi/), now 
fixed, but I'm more referring to the more general issue.

My guess is, if python continues to grow in popularity, it is only a matter of 
time before some unhelpful folks decide to reserve generic package names 
(common words etc.) and there is a market for selling PyPI package names (like 
the situation with domain names now). Personally, I'm not sure this would be 
good for the python community, but I don't know if there is (or could be) any 
solutions?

--
messages: 365454
nosy: ChrisRands
priority: normal
severity: normal
status: open
title: Mechanism to control who owns package names on PyPI?

___
Python tracker 

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



[issue40132] Mechanism to control who owns package names on PyPI?

2020-04-01 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi Chris, this is explicitly forbidden in the Terms of use of Pypi and the PEP 
451 at https://www.python.org/dev/peps/pep-0541/#invalid-projects:


> Invalid projects

> A project published on the Package Index meeting ANY of the following is 
> considered invalid and will be removed from the Index:

[...]

> project is malware (designed to exploit or harm systems or users);

[...]

> project is name squatting (package has no functionality or is empty);

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread Eryk Sun


Eryk Sun  added the comment:

> It's more the opposite, if tomorrow we want to encode the status 
> of a terminated process differently, it will be easier if 
> os.waitstatus_to_exitcode() is available, no?

This new status-to-exitcode function applies to Windows waitpid() only due to a 
design choice in CPython -- not the operating system. The current waitpid() 
implementation assumes it's okay to discard the upper 8 bits of the exit 
status, which can lose important information. Maybe it's best to address 
Windows support in a new issue that also addresses the design of waitpid() in 
3.9, in particular if this would change the design of the new function -- at 
the very least with regard to data type (e.g. `int status` doesn't have the 
required range).

Off topic: Despite the function name, waitpid in Windows takes a process 
handle, such as is returned by os.spawn*, and not a process ID, such as is 
required by os.kill. The current documentation is sometimes clear on this 
detail but sometimes confusingly mixes up "handle" and "id" in Windows-only 
sections.

> The result is a Python object. IMHO it's ok if the shifted result 
> ("status") is larger than 32 bits. But I'm not sure that the 
> current os.waitpid() implementation handles integer overflow 
> correctly...

The overflow problem could be addressed by using a 64-bit value for the status 
in os_waitpid_impl and elsewhere.

> Do you suggest that os.waitstatus_to_exitcode() result should be 
> negative if a process was terminated by TerminateProcess()?

Returning a signed result is an interesting suggestion. The native process exit 
status is actually an NTSTATUS value, and NTSTATUS and HRESULT codes are 
signed, with failure codes (i.e. errors and warnings) reported as negative 
values. That said, the exit status gets handled as an unsigned value in the 
Windows API, e.g. ExitProcess, TerminateProcess, and GetExitCodeProcess.

> When I look at GetExitCodeProcess() documentation, I don't see any 
> distinction between "normal exit" and a program terminated by 
> TerminateProcess(). The only different is the actual exit code:

In almost all cases a process terminates via TerminateProcess -- or rather the 
internal NTAPI function NtTerminateProcess. For a clean exit via ExitProcess 
(i.e. native RtlExitUserProcess), NtTerminateProcess gets called twice. The 
first time it gets called specially (with the process handle passed as NULL) in 
order to forcefully terminate all other threads in the process. Once the thread 
that calls ExitProcess is the last remaining thread, the loader shuts down the 
user-mode aspects of the process (e.g. it calls DLL entry points for process 
detach). Finally, the last thread makes a regular NtTerminateProcess call (with 
the current-process handle instead of NULL), which actually terminates the 
process.

An abnormal termination just does the latter step, but it doesn't necessarily 
use an exit status value that clearly indicates an abnormal termination. Thus 
not all abnormal terminations can be identified as such. Also, nothing stops a 
normal termination via ExitProcess from using an NTSTATUS code. For example, 
the default control handler for a console process exits via ExitProcess with 
the status code STATUS_CONTROL_C_EXIT (0xC000_013A). This is similar to an 
abnormal exit, since the process is killed by the closest thing to a Unix 
'signal' that Windows console applications support. Moreover, the same status 
code is used for a genuinely abnormal exit due to a Ctrl+Close event (i.e. the 
console window was closed) if the session server is forced to terminate a 
console process that doesn't exit gracefully in the allotted time (default 5 
seconds).

--

___
Python tracker 

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



[issue40133] Provide additional matchers for unittest.mock

2020-04-01 Thread Diego Elio Pettenò

New submission from Diego Elio Pettenò :

The unittest.mock `assert_called_*with*` methods take either literals, or the 
single `ANY` special matcher 
(https://docs.python.org/3/library/unittest.mock.html#any) to match any 
argument.

Experience suggests me that it's useful to have more flexible matchers, such as 
INSTANCEOF or REGEXP.

Will provide a starting pull request for this today. (Be warned: it's the first 
time I try contributing to CPython.)

--
components: Tests
messages: 365457
nosy: Diego Elio Pettenò
priority: normal
severity: normal
status: open
title: Provide additional matchers for unittest.mock
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue40133] Provide additional matchers for unittest.mock

2020-04-01 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



[issue40134] Inconsistent ANSI escape code handling on Windows 10

2020-04-01 Thread Dave Rove


New submission from Dave Rove :

The correct handling of ANSI escape codes by the print() function may or may 
not be enabled in the Windows 10 command prompt window, depending on previous 
system calls. The following is quite repeatable. Comment-out the apparently 
meaningless os.system("") line and ANSI codes do not work, but leave that line 
in and ANSI codes DO work:

import os
os.system("") # Comment this out to disable ANSI codes
ansi_red = "\x1b[31m"
ansi_normal = "\x1b[0m"
print(ansi_red + "This is red!" + ansi_normal)

To be consistent with Python on Linux and Mac, I believe that ANSI codes should 
be permanently enabled in Windows 10 rather than removed. ANSI code handling 
was present from the start of Windows 10, so it's reasonable to presume that 
it's now a permanent feature of the Windows command prompt window. Either way, 
the inconsistency of the handling should be fixed.

To emphasize that ANSI codes ARE a feature of the command prompt, comment out 
that line to disable the ANSI codes in print(), but redirect the output to a 
text file. Then display that file at the command prompt. The ANSI codes then 
work correctly. 

python myansi.py > myansi.txt
type myansi.txt

--
components: Windows
messages: 365458
nosy: daverove, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Inconsistent ANSI escape code handling on Windows 10
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



[issue40130] Remove _PyUnicode_AsKind from private C API

2020-04-01 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



[issue40130] Remove _PyUnicode_AsKind from private C API

2020-04-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 17b4733f2ff0a4abc06e8c745755c06fc32942dd by Serhiy Storchaka in 
branch 'master':
bpo-40130: _PyUnicode_AsKind() should not be exported. (GH-19265)
https://github.com/python/cpython/commit/17b4733f2ff0a4abc06e8c745755c06fc32942dd


--

___
Python tracker 

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



[issue40121] socket module missing audit events

2020-04-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18632
pull_request: https://github.com/python/cpython/pull/19276

___
Python tracker 

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



[issue39837] Remove Azure Pipelines from GitHub PRs

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

I cannot merge a PR until it completes. It re-runs jobs which are already run 
as GH Actions.

There is another annoying issue with Azure Pipelines. When a job fails randomly 
for whatever reason, a job cannot be re-run, even if I log in Microsoft Azure.

Usually, the workaround is to close/reopen a PR to re-run all CIs.

Except that for a backport PR created automatically by miss-islington bot, when 
I close the PR, the bot removes its branch and so the PR cannot be re-open.

Well, the second workaround is to ask the bot to create a new PR backport. That 
what I did.

I did that for PR 19276 of bpo-40121. It's annoying to have to use *two* 
workarounds.

On the other side, Travis CI is not currently required, I don't understand why.

Is it possible to make Travis CI required and make Azure Pipelines not required?

--

___
Python tracker 

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



[issue40121] socket module missing audit events

2020-04-01 Thread miss-islington


miss-islington  added the comment:


New changeset f971c8c0a0fbe1959843179e2811b047001125a0 by Miss Islington (bot) 
in branch '3.8':
bpo-40121: Fix exception type in test (GH-19267)
https://github.com/python/cpython/commit/f971c8c0a0fbe1959843179e2811b047001125a0


--

___
Python tracker 

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



[issue40135] multiprocessing: test_shared_memory_across_processes() cannot be run twice in parallel

2020-04-01 Thread STINNER Victor


New submission from STINNER Victor :

Sometimes, I need to run multiprocessing tests multiple times in parallel to 
attempt to reproduce a race condition. Except that 
test_shared_memory_across_processes() fails in this case:

$ ./python -m test test_multiprocessing_spawn --fail-env-changed -v -j4 -F -m 
test_shared_memory_across_processes 

== CPython 3.9.0a5+ (heads/master:17b4733f2f, Apr 1 2020, 15:02:04) [GCC 9.2.1 
20190827 (Red Hat 9.2.1-1)]
== Linux-5.5.9-200.fc31.x86_64-x86_64-with-glibc2.30 little-endian
== cwd: /home/vstinner/python/master/build/test_python_1133450
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
0:00:00 load avg: 1.64 Run tests in parallel using 4 child processes
0:00:01 load avg: 1.64 [  1/1] test_multiprocessing_spawn failed
test_shared_memory_across_processes 
(test.test_multiprocessing_spawn.WithProcessesTestSharedMemory) ... ERROR

==
ERROR: test_shared_memory_across_processes 
(test.test_multiprocessing_spawn.WithProcessesTestSharedMemory)
--
Traceback (most recent call last):
  File "/home/vstinner/python/master/Lib/test/_test_multiprocessing.py", line 
3862, in test_shared_memory_across_processes
sms = shared_memory.SharedMemory('test02_tsmap', True, size=512)
  File "/home/vstinner/python/master/Lib/multiprocessing/shared_memory.py", 
line 100, in __init__
self._fd = _posixshmem.shm_open(
FileExistsError: [Errno 17] File exists: '/test02_tsmap'

--

Ran 1 test in 0.247s

FAILED (errors=1)
test test_multiprocessing_spawn failed
Kill  process group
Kill  process group
Kill  process group

== Tests result: FAILURE ==

1 test failed:
test_multiprocessing_spawn

Total duration: 1.2 sec
Tests result: FAILURE

--
components: Tests
messages: 365462
nosy: vstinner
priority: normal
severity: normal
status: open
title: multiprocessing: test_shared_memory_across_processes() cannot be run 
twice in parallel
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue40135] multiprocessing: test_shared_memory_across_processes() cannot be run twice in parallel

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

Python 3.7 is not affected: it doesn't have 
test_shared_memory_across_processes().

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



[issue40120] Undefined C behavior going beyond end of struct via a [1] arrays.

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

The following C++ code fails to build:
---
#ifdef __cplusplus
#  include 
#else
#  include 
#endif

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
int x;
int y;
char array[];
} mystruct_t;

#ifdef __cplusplus
}
#endif

int main()
{
size_t size = 2;
mystruct_t *obj = (mystruct_t *)malloc(sizeof(mystruct_t) - 1 + size);
obj->array[0] = 'O';
obj->array[1] = 'K';
free(obj);
return 0;
}
---

Error:
---
$ LANG= g++ -pedantic -Werror x.cpp
x.c:14:10: error: ISO C++ forbids flexible array member 'array' 
[-Werror=pedantic]
   14 | char array[];
  |  ^
cc1plus: all warnings being treated as errors
---

--

___
Python tracker 

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



[issue40120] Undefined C behavior going beyond end of struct via a [1] arrays.

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

Modules/hashtable.c and Modules/hashtable.h use a different approach. The 
variable size data is *not* part of the structure:

typedef struct {
/* used by _Py_hashtable_t.buckets to link entries */
_Py_slist_item_t _Py_slist_item;

Py_uhash_t key_hash;

/* key (key_size bytes) and then data (data_size bytes) follows */
} _Py_hashtable_entry_t;

In memory, we have: [_Py_slist_item, key_hash, key, data] where key size is 
table->key_size bytes (not stored in each table entry, only in the stable).

Pointer to key and data is computed with these macros:

#define _Py_HASHTABLE_ENTRY_PKEY(ENTRY) \
((const void *)((char *)(ENTRY) \
+ sizeof(_Py_hashtable_entry_t)))

#define _Py_HASHTABLE_ENTRY_PDATA(TABLE, ENTRY) \
((const void *)((char *)(ENTRY) \
+ sizeof(_Py_hashtable_entry_t) \
+ (TABLE)->key_size))

But this approach is more annoying to use, it requires to play with pointers 
and requires such ugly macros.

--

___
Python tracker 

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



[issue40120] Undefined C behavior going beyond end of struct via a [1] arrays.

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

> Undefined C behavior going beyond end of struct via a [1] arrays.

How is it an undefined C behavior? It works well in practice, no?

--

___
Python tracker 

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



[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18634
pull_request: https://github.com/python/cpython/pull/19278

___
Python tracker 

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



[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +18633
pull_request: https://github.com/python/cpython/pull/19277

___
Python tracker 

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



[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7c72383f95b0cdedf390726069428d7b69ed2597 by Victor Stinner in 
branch 'master':
bpo-40094: Enhance os.WIFEXITED documentation (GH-19244)
https://github.com/python/cpython/commit/7c72383f95b0cdedf390726069428d7b69ed2597


--

___
Python tracker 

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



[issue33262] Deprecate shlex.split(None) to read from stdin.

2020-04-01 Thread Paul Ganssle


Paul Ganssle  added the comment:


New changeset 975ac326ffe265e63a103014fd27e9d098fe7548 by Zackery Spytz in 
branch 'master':
bpo-33262: Deprecate passing None for `s` to shlex.split() (GH-6514)
https://github.com/python/cpython/commit/975ac326ffe265e63a103014fd27e9d098fe7548


--
nosy: +p-ganssle

___
Python tracker 

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



[issue40136] add warning to datetime.replace documentation to not use it for setting tzinfo unless UTC or None

2020-04-01 Thread Benedikt Bleimhofer


New submission from Benedikt Bleimhofer :

It would probably save some people a lot of time if the documentation of 
datetime.replace 
(https://docs.python.org/3/library/datetime.html#datetime.datetime.replace) 
showed a warning not to use it for setting the timezone on a datetime object or 
at least that there is a high chance that the result will not be what you 
expect.

"
If you don't use tz.localize(), but use datetime.replace(), chances are that a 
historical offset is used instead; tz.localize() will pick the right offset in 
effect for the given date.
"
More information on the problem can be found here:
https://stackoverflow.com/questions/13994594/how-to-add-timezone-into-a-naive-datetime-instance-in-python

I ran into this problem and it took me quite some time to figure this out. 
datetime.replace seems more intuitive to use in this case, but since it does 
not work it might be useful to even link to tz.localize.

--
assignee: docs@python
components: Documentation
messages: 365469
nosy: Benedikt Bleimhofer, docs@python
priority: normal
severity: normal
status: open
title: add warning to datetime.replace documentation to not use it for setting 
tzinfo unless UTC or None
type: enhancement

___
Python tracker 

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



[issue40136] add warning to datetime.replace documentation to not use it for setting tzinfo unless UTC or None

2020-04-01 Thread Paul Ganssle


Paul Ganssle  added the comment:

That is a specific problem with the third-party library `pytz`, not a standard 
feature of the datetime module. Using `datetime.replace` is the intended way to 
set a time zone, see: 
https://blog.ganssle.io/articles/2018/03/pytz-fastest-footgun.html

As of Python 3.6, we've been recommending dateutil.tz instead of pytz, and 
assuming PEP 615 is accepted ( https://www.python.org/dev/peps/pep-0615/ ), we 
will have a built in time zone type that supports IANA time zones.

I am going to close this because this is not a bug in CPython, but if you think 
otherwise feel free to continue using this ticket to make the case.

--
nosy: +p-ganssle
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



[issue39983] test.regrtest: test marked as failed (env changed), but no warning: test_multiprocessing_forkserver

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

Another example: AMD64 RHEL7 LTO 3.7
"1 test altered the execution environment: test_multiprocessing_spawn"
https://buildbot.python.org/all/#/builders/43/builds/138

--

___
Python tracker 

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



[issue40120] Undefined C behavior going beyond end of struct via a [1] arrays.

2020-04-01 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

AFAIK extern "C" only affects mangling of function names. Because of 
overloading in C++ you can have several functions with the same name, and to 
distinguish "int abs(int)" from "float abs(float)" the C++ compiler mangles 
function names, that makes them incompatible with C.

--

___
Python tracker 

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



[issue39682] pathlib.Path objects can be used as context managers

2020-04-01 Thread Antoine Pitrou


Change by Antoine Pitrou :


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

___
Python tracker 

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



[issue39682] pathlib.Path objects can be used as context managers

2020-04-01 Thread Antoine Pitrou


Change by Antoine Pitrou :


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



[issue39682] pathlib.Path objects can be used as context managers

2020-04-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset 2e6d8b0ccdb6e0d9e98a9a7f9c9edfdf1311 by Barney Gale in branch 
'master':
bpo-39682: make `pathlib.Path` immutable by removing (undocumented) support for 
"closing" a path by using it as a context manager (GH-18846)
https://github.com/python/cpython/commit/2e6d8b0ccdb6e0d9e98a9a7f9c9edfdf1311


--

___
Python tracker 

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



[issue39682] pathlib.Path objects can be used as context managers

2020-04-01 Thread Antony Lee


Change by Antony Lee :


--
nosy:  -Antony.Lee

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2020-04-01 Thread Michael Felt


Michael Felt  added the comment:

With PR19263 The AIX bots are now red.

==
ERROR: test_input_no_stdout_fileno (test.test_builtin.PtyTests)
--
Traceback (most recent call last):
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-aix-ppc64/build/Lib/test/test_builtin.py",
 line 1952, in test_input_no_stdout_fileno
lines = self.run_child(child, b"quux\r")
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-aix-ppc64/build/Lib/test/test_builtin.py",
 line 1898, in run_child
support.wait_process(pid, exitcode=0)
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-aix-ppc64/build/Lib/test/support/__init__.py",
 line 3432, in wait_process
os.kill(pid, signal.SIGKILL)
NameError: name 'signal' is not defined
--
Ran 101 tests in 30.348s
FAILED (errors=1, skipped=7)
1 test failed again:
test_builtin

+++
The Buildbot has detected a failed build on builder PPC64 AIX 3.x while 
building python/cpython.
Full details are available at:
https://buildbot.python.org/all/#builders/227/builds/565

Buildbot URL: https://buildbot.python.org/all/

Worker for this Build: edelsohn-aix-ppc64
Worker for this Build: aixtools-aix-power6

--
nosy: +Michael.Felt

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

> With PR19263 The AIX bots are now red.

I know, I saw and I already pushed fixes.

> NameError: name 'signal' is not defined

Fixed by commit afeaea2d6e346f627b24cc9e84e2986a7266a70e.

> 1 test failed again: test_builtin

Fixed by commit 16d75675d2ad2454f6dfbf333c94e6237df36018.

--

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

> Ah - great. Sorry for the noise then.

It's not noise, it is useful :-)

--

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2020-04-01 Thread Michael Felt


Michael Felt  added the comment:

Ah - great. Sorry for the noise then.

--

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2020-04-01 Thread Michael Felt


Michael Felt  added the comment:

I think something is not yet what it needs to be:

the bots both finish test with:

test_zip_pickle (test.test_builtin.BuiltinTest) ... ok
Timeout (0:15:00)!
Thread 0x0001 (most recent call first):
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/support/__init__.py",
 line 3435 in wait_process
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/test_builtin.py",
 line 1898 in run_child
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/test_builtin.py",
 line 1952 in test_input_no_stdout_fileno
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/case.py", 
line 616 in _callTestMethod
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/case.py", 
line 659 in run
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/case.py", 
line 719 in __call__
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/suite.py", 
line 122 in run
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/suite.py", 
line 84 in __call__
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/suite.py", 
line 122 in run
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/suite.py", 
line 84 in __call__
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/suite.py", 
line 122 in run
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/suite.py", 
line 84 in __call__
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/unittest/runner.py",
 line 176 in run
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/support/__init__.py",
 line 2079 in _run_suite
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/support/__init__.py",
 line 2201 in run_unittest
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/libregrtest/runtest.py",
 line 209 in _test_module
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/libregrtest/runtest.py",
 line 234 in _runtest_inner2
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/libregrtest/runtest.py",
 line 270 in _runtest_inner
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/libregrtest/runtest.py",
 line 153 in _runtest
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/libregrtest/runtest.py",
 line 193 in runtest
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/libregrtest/main.py",
 line 318 in rerun_failed_tests
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/libregrtest/main.py",
 line 691 in _main
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/libregrtest/main.py",
 line 634 in main
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/libregrtest/main.py",
 line 712 in main
  File 
"/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/test/__main__.py", 
line 2 in 
  File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/runpy.py", 
line 87 in _run_code
  File "/home/buildbot/buildarea/3.x.aixtools-aix-power6/build/Lib/runpy.py", 
line 197 in _run_module_as_main
make: 1254-004 The error code from the last command is 1.
Stop.
program finished with exit code 2
elapsedTime=3501.292487
test_input_no_stdout_fileno (test.test_builtin.PtyTests) ... 

And the bot status is still FAIL (aka red): failed test (failure) uploading 
test-results.xml (failure)

--

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

> I think something is not yet what it needs to be: (...)

https://buildbot.python.org/all/#/builders/227/builds/571 build failed but it 
has my commit 16d75675d2ad2454f6dfbf333c94e6237df36018. Ok, something failed.

Please open a new issue. This one is closed.

--

___
Python tracker 

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



[issue40071] test__xxsubinterpreters leaked [1, 1, 1] references: test_ids_global()

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset eacc07439591c97f69ab4a3d17391b009cd78ae2 by Paulo Henrique Silva 
in branch 'master':
bpo-40071: Fix potential crash in _functoolsmodule.c (GH-19273)
https://github.com/python/cpython/commit/eacc07439591c97f69ab4a3d17391b009cd78ae2


--

___
Python tracker 

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



[issue12735] request full Unicode collation support in std python library

2020-04-01 Thread Matej Cepl

Matej Cepl  added the comment:

Isn’t this done by the system? It feels like barking at the wrong tree.

--

___
Python tracker 

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



[issue40137] TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented

2020-04-01 Thread STINNER Victor


New submission from STINNER Victor :

In bpo-1635741, many C extension modules are converted to PEP 489 multiphase 
initialization and/or modified to get a module state. Problem: the module state 
cannot be accessed in some functions, and so some of these changes had to 
workaround the fact that PEP 573 "Module State Access from C Extension Methods" 
is not implemented yet.

This issue tracks C extension modules which should be modified once PEP 573 
will be implemented:

* _functools: Py_CLEAR(kwd_mark); is commented in _functools_free()
  See commit eacc07439591c97f69ab4a3d17391b009cd78ae2

* _abc: abc_invalidation_counter is shared by all module instances. 
abc_data_new() requires access to abc_invalidation_counter but it doesn't have 
access to the module state. abc_invalidation_counter should be moved to the 
module state.

--
components: Library (Lib)
messages: 365482
nosy: vstinner
priority: normal
severity: normal
status: open
title: TODO list when PEP 573 "Module State Access from C Extension Methods" 
will be implemented
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue40071] test__xxsubinterpreters leaked [1, 1, 1] references: test_ids_global()

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

I closed the issue, the leak is now fixed and _functools has been fixed.

I created bpo-40137: TODO list when PEP 573 "Module State Access from C 
Extension Methods" will be implemented.

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



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

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

I created bpo-40137: TODO list when PEP 573 "Module State Access from C 
Extension Methods" will be implemented.

It tracks code that should be fixed once PEP 573 will be implemented, like 
_functools and _abc modules.

--

___
Python tracker 

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



[issue40137] TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented

2020-04-01 Thread Paulo Henrique Silva


Change by Paulo Henrique Silva :


--
nosy: +phsilva

___
Python tracker 

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



[issue38527] configure script fails to detect "float word ordering" on Solaris

2020-04-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18635
pull_request: https://github.com/python/cpython/pull/19279

___
Python tracker 

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



[issue38527] configure script fails to detect "float word ordering" on Solaris

2020-04-01 Thread miss-islington


miss-islington  added the comment:


New changeset 5dd836030e0e399b21ab0865ae0d93934bdb3930 by Arnon Yaari in branch 
'master':
bpo-38527: fix configure script for Solaris (GH-16845)
https://github.com/python/cpython/commit/5dd836030e0e399b21ab0865ae0d93934bdb3930


--
nosy: +miss-islington

___
Python tracker 

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



[issue40137] TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented

2020-04-01 Thread Dong-hee Na


Change by Dong-hee Na :


--
keywords: +patch
nosy: +corona10
nosy_count: 2.0 -> 3.0
pull_requests: +18636
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19177

___
Python tracker 

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



[issue40137] TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

Another minor issue: "assert(PyScanner_Check(self));" and 
"assert(PyEncoder_Check(self));" were removed by commit 
33f15a16d40cb8010a8c758952cbf88d7912ee2d when _json module got a module state.

scanner_traverse(), scanner_clear(), encoder_traverse() and encoder_clear() 
cannot get the module state of a module using PEP 489 multiphase initialization.

Similar issue in scanner_call() and encoder_call().

I'm not sure that the PEP 573 provide a solution for this exact issue, since 
the intent of the assertion is to check the type of the argument. The PEP 573 
gives access to the module state through types. But here we are not sure that 
the object type is the expected type... :-)

Again, it's a minor issue, it can be ignored. That's why I accepted to merge 
the commit. Technically, I don't see how we could get the wrong type in 
practice.

--

___
Python tracker 

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



[issue38527] configure script fails to detect "float word ordering" on Solaris

2020-04-01 Thread miss-islington


miss-islington  added the comment:


New changeset fc036409226d2c65dad9503854f09b9a39c84f14 by Miss Islington (bot) 
in branch '3.8':
bpo-38527: fix configure script for Solaris (GH-16845)
https://github.com/python/cpython/commit/fc036409226d2c65dad9503854f09b9a39c84f14


--

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-04-01 Thread Dong-hee Na


Change by Dong-hee Na :


Added file: https://bugs.python.org/file49020/bench_dict_update.py

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-04-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

+--+---+-+
| Benchmark| master-dict-empty | bpo-37207-dict-empty|
+==+===+=+
| bench dict empty | 502 ns| 443 ns: 1.13x faster (-12%) |
+--+---+-+

+--++-+
| Benchmark| master-dict-update | bpo-37207-dict-update   |
+==++=+
| bench dict empty | 497 ns | 425 ns: 1.17x faster (-15%) |
+--++-+

++-+-+
| Benchmark  | master-dict-kwnames | bpo-37207-dict-kwnames  |
++=+=+
| bench dict kwnames | 1.38 us | 917 ns: 1.51x faster (-34%) |
++-+-+

--

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-04-01 Thread Dong-hee Na


Change by Dong-hee Na :


Added file: https://bugs.python.org/file49019/bench_dict_kwnames.py

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-04-01 Thread Dong-hee Na


Change by Dong-hee Na :


Added file: https://bugs.python.org/file49018/bench_dict_empty.py

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-04-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

@vstinner @petr.viktorin

Looks like benchmark showing very impressive result.
Can I submit the patch?

--

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-04-01 Thread Petr Viktorin


Petr Viktorin  added the comment:

> Can I submit the patch?

Yes!

If you think a patch is ready for review, just submit it. There's not much we 
can comment on before we see the code :)

(I hope that doesn't contradict what your mentor says...)

--

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

When I designed the FASTCALL calling convention, I experimented a new 
tp_fastcall slot to PyTypeObject to optimize __call__() method: bpo-29259.

Results on the pyperformance benchmark suite were not really convincing and I 
had technical issues (decide if tp_call or tp_fastcall should be called, handle 
ABI compatibility and backward compatibility, etc.). I decided to give up on 
this idea.

I'm happy to see that PEP 590 managed to find its way into Python internals and 
actually make Python faster ;-)

--

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-04-01 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +18637
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/19280

___
Python tracker 

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



[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

Eryk:
> The current waitpid() implementation assumes it's okay to discard the upper 8 
> bits of the exit status, which can lose important information.

That's a bug which is independent of this issue.

> Thus not all abnormal terminations can be identified as such. Also, nothing 
> stops a normal termination via ExitProcess from using an NTSTATUS code.

Ok, so the current os.waitstatus_to_exitcode() design is fine. On Windows, we 
can just consider all exit code as a "normal" process exit code.

And there is no need to modify os.waitpid() to return a negative value for 
values larger than (INT_MAX >> 8). We should "just" fix 
os.waitstatus_to_exitcode() to accept any Python integer and simply compute "x 
>> 8", whereas currently the argument is casted to a C int.

I propose to fix os.waitpid() and os.waitstatus_to_exitcode() for "large" exit 
code on Windows in a second time.

--

___
Python tracker 

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



[issue40134] Inconsistent ANSI escape code handling on Windows 10

2020-04-01 Thread Paul Moore


Paul Moore  added the comment:

This works fine for me in Windows terminal, but I see the behaviour described 
when using the conventional "Command prompt" window.

Enabling ANSI codes is handled via SetConsoleMode (see here: 
https://docs.microsoft.com/en-us/windows/console/setconsolemode). The following 
proof of concept script correctly displays coloured text:

from ctypes import *
kernel32 = windll.kernel32
kernel32.SetConsoleMode(kernel32.GetStdHandle(-11), 7)
ansi_red = "\x1b[31m"
ansi_normal = "\x1b[0m"
print(ansi_red + "This is red!" + ansi_normal)

Agreed this would be worthwhile setting on stdout by default. The code at 
https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#example-of-enabling-virtual-terminal-processing
 seems to be an example of how to do this while still supporting older systems

--

___
Python tracker 

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



[issue40137] TODO list when PEP 573 "Module State Access from C Extension Methods" will be implemented

2020-04-01 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 65a796e5272f61b42792d3a8c69686558c1872c5 by Victor Stinner in 
branch 'master':
bpo-40094: Add os.waitstatus_to_exitcode() (GH-19201)
https://github.com/python/cpython/commit/65a796e5272f61b42792d3a8c69686558c1872c5


--

___
Python tracker 

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



[issue38527] configure script fails to detect "float word ordering" on Solaris

2020-04-01 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



[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

sys.exit() accepts negative number and values larger than 255. I checked with 
strace: Python calls Linux exit_group() syscall with the value passed to 
sys.exit().

But then os.waitid() (waitid, not waitpid!) returns the lower 8-bits of the 
exit code.

In fact, the exit_group() syscall truncates the exit status:
https://github.com/torvalds/linux/blob/1a323ea5356edbb3073dc59d51b9e6b86908857d/kernel/exit.c#L895-L905

So on Linux, an exit code is always in the range [0; 255]. For example, 
exit_group(-1) syscall gives an exit code of 255.

--

___
Python tracker 

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



[issue39837] Remove Azure Pipelines from GitHub PRs

2020-04-01 Thread Brett Cannon


Brett Cannon  added the comment:

> Is it possible to make Travis CI required and make Azure Pipelines not 
> required?

Yes, but I don't want to to do that as we have had equivalent flakiness issues 
with Travis which is why it isn't required ATM.

The only way to prevent flaky CI from blocking anything is to simply make no CI 
required and trust core devs not to merge unless they are certain they know why 
a CI run failed (although I don't know what that does to miss-islington). 
Passed that is being extremely specific about what CI is considered stable 
enough to block on an would probably need to be down to the OS level on top of 
what is being tested.

--

___
Python tracker 

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



[issue40136] add warning to datetime.replace documentation to not use it for setting tzinfo unless UTC or None

2020-04-01 Thread Benedikt Bleimhofer


Benedikt Bleimhofer  added the comment:

Thx for this really helpful info.
After reading the article i switched all my code from using pytz to dateutil.tz.

--

___
Python tracker 

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



[issue40138] Windows implementation of os.waitpid() truncates the exit status (status << 8)

2020-04-01 Thread STINNER Victor


New submission from STINNER Victor :

On Windows, the exit code is a 32-bit value. It may or may not signed depending 
on the function.

Unsigned in the Windows native API:

BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode);
BOOL GetExitCodeProcess(HANDLE hProcess, LPDWORD lpExitCode);

Signed in the POSIX API:

intptr_t _cwait(int *termstat, intptr_t procHandle, int action);

Problem: os.waitpid() uses "status << 8" which can overflow; status is an int.

static PyObject *
os_waitpid_impl(PyObject *module, intptr_t pid, int options)
{
int status;
(...)
/* shift the status left a byte so this is more like the POSIX waitpid */
return Py_BuildValue(_Py_PARSE_INTPTR "i", res, status << 8);
}

int64_t or uint64_t should be used, or a Python object should be used, to avoid 
the overflow.

I just added os.waitstatus_to_exitcode() in bpo-40094 which simply does "status 
>> 8" on Windows. Currently, this function casts the argument to a C int and so 
is limited to INT_MAX. It should also be adapted to handle values larger than 
INT_MAX.

By the way, I'm not sure how to handle values larger than INT_MAX. The POSIX 
API of Windows uses a signed integer, and so convert such value as a negative 
value. But the native Windows API uses unsigned numbers.

It seems like using unsigned number would be better.

--

By the way, currently os.waitstatus_to_exitcode() ignores the lower 8 bits of 
the status. Maybe it should raise an error if lower 8 bits are not zero, and 
maybe also raise an exception if the number is negative?


--

See also interesting comments by Eryk Sun in bpo-40094 about this problem.

--
components: Library (Lib)
messages: 365498
nosy: vstinner
priority: normal
severity: normal
status: open
title: Windows implementation of os.waitpid() truncates the exit status (status 
<< 8)
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



[issue40094] Add os.waitstatus_to_exitcode() function

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

TODO:

* Modify asyncio.unix_events._compute_returncode() to use 
waitstatus_to_exitcode(): need to update tests.
* Modify run_cgi() of http.server to log the exit code rather the exit status: 
use waitstatus_to_exitcode().
* Modify Tools/scripts/which.py to log the exit code using 
waitstatus_to_exitcode(): result of os.system('ls ' + longlist + ' ' + 
filename).
* Modify mailcap.test() to use waitstatus_to_exitcode(): os.system(command).
* Fix CI to get PR 19277 and PR 19278 merged.
* Decide if subprocess should reject WIFSTOPPED() or not.
* Check if the pure Python implementation of os._spawnvef() handles 
WIFSTOPPED() properly.
* Maybe implement timeout on Windows for test.support.wait_process().


Eryk Sun:
> FWIW, I wouldn't recommend relying on os.waitpid to get the correct process 
> exit status in Windows. Status codes are 32 bits and generally all bits are 
> required.

I created bpo-40138 "Windows implementation of os.waitpid() truncates the exit 
status (status << 8)".

--

___
Python tracker 

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



[issue40048] _PyEval_EvalFrameDefault() doesn't reset tstate->frame if _PyCode_InitOpcache() fails

2020-04-01 Thread Dong-hee Na


Change by Dong-hee Na :


--
nosy: +corona10

___
Python tracker 

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



[issue39740] Select module fails to build on Solaris 11.4

2020-04-01 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


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

___
Python tracker 

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



[issue40139] mimetypes module racy

2020-04-01 Thread Uwe Kleine-König

New submission from Uwe Kleine-König :

Hello,

in a project using aiohttp with Python 3.5 as provided by Debian Stretch 
(3.5.3) I sometimes see a wrong mimetype assigned to .css files. When trying to 
create a minimal reproduction recipe a colleage and I came up with:

import asyncio
import sys
from mimetypes import guess_type

async def f():
t = guess_type('foo.css')

return t == ('text/css', None)


async def main():
done, pending = await asyncio.wait([
asyncio.ensure_future(f()),
asyncio.ensure_future(f()),
])

return all(d.result() for d in done)

if __name__ == '__main__':
loop = asyncio.get_event_loop()
if not loop.run_until_complete(main()):
print("FAIL")
exit(1)

We didn't see this exact code failing but something very similar and only once. 
Up to now we only tested on Python 3.5 as this is what is used in production.

By code inspection I found a race: In the module's guess_type function there is:

if _db is None:
init()
return ...

It can happen here that init() is entered twice when the first context entered 
init() but gets preempted before setting _db.

However I failed to see how this can result in guess_type returning None (which 
is what we occasionally see in our production code).

Also the code in mimetypes.py is rather convoluted with two different guards 
for not calling init (_db is None + not inited), init() updating various global 
variables and instantiating a MimeTypes object that depends on these variables, 
...

mimetypes.py changed in master a few times, as I didn't spot the actual problem 
yet and the issue hardly reproduces I cannot tell if the problem still exists 
in newer versions of Python.

There are also some bug reports that seem related, I found reading 
https://bugs.python.org/issue38656 and https://bugs.python.org/issue4963 
interesting.

Best regards
Uwe

--
components: Library (Lib)
messages: 365500
nosy: ukl
priority: normal
severity: normal
status: open
title: mimetypes module racy
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue40138] Windows implementation of os.waitpid() truncates the exit status (status << 8)

2020-04-01 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +eryksun

___
Python tracker 

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



[issue12735] request full Unicode collation support in std python library

2020-04-01 Thread Ahmad Azizi


Ahmad Azizi  added the comment:

No, this is not an OS dependent issue. Python does not use Unicode 
collation(uses utf-8) for sorting.

--
versions:  -Python 3.4

___
Python tracker 

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



[issue40048] _PyEval_EvalFrameDefault() doesn't reset tstate->frame if _PyCode_InitOpcache() fails

2020-04-01 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Will prepare a pr soon

--

___
Python tracker 

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



[issue39837] Remove Azure Pipelines from GitHub PRs

2020-04-01 Thread Steve Dower


Steve Dower  added the comment:

Or we could remove the path filter on GitHub Actions so that all checks run 
even for doc-only changes? Then they can be marked as required.

--

___
Python tracker 

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



[issue40115] test_asyncio leaked [3, 3, 3] references, sum=9

2020-04-01 Thread Kyle Stanley


Kyle Stanley  added the comment:

Currently working on addressing this, see bpo-39812. If I can't find a fix by 
tonight, I'll open a PR to revert it for now so that other regressions don't go 
undetected in the meantime.

--
nosy: +aeros

___
Python tracker 

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



[issue40140] test_builtin crashes when runned in parallel mode on solaris

2020-04-01 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

test_builting works on serial run

0:00:00 load avg: 2.38 Run tests sequentially
0:00:00 load avg: 2.38 [1/1] test_builtin

== Tests result: SUCCESS ==

1 test OK.

Total duration: 1.3 sec
Tests result: SUCCESS

but with more then one processes, it crashes 

0:00:00 load avg: 1.71 Run tests in parallel using 2 child processes
0:00:01 load avg: 1.70 [1/1/1] test_builtin crashed (Exit code -1)
test_abs (test.test_builtin.BuiltinTest) ... ok
test_all (test.test_builtin.BuiltinTest) ... ok
test_any (test.test_builtin.BuiltinTest) ... ok
test_ascii (test.test_builtin.BuiltinTest) ... ok
test_bin (test.test_builtin.BuiltinTest) ... ok
test_bug_27936 (test.test_builtin.BuiltinTest) ... ok
test_bytearray_extend_error (test.test_builtin.BuiltinTest) ... ok
test_bytearray_translate (test.test_builtin.BuiltinTest) ... ok
test_callable (test.test_builtin.BuiltinTest) ... ok
test_chr (test.test_builtin.BuiltinTest) ... ok
test_cmp (test.test_builtin.BuiltinTest) ... ok
test_compile (test.test_builtin.BuiltinTest) ... ok
test_compile_async_generator (test.test_builtin.BuiltinTest)
With the PyCF_ALLOW_TOP_LEVEL_AWAIT flag added in 3.8, we want to ... ok
test_compile_top_level_await (test.test_builtin.BuiltinTest)
Test whether code some top level await can be compiled. ... ok
test_compile_top_level_await_invalid_cases (test.test_builtin.BuiltinTest) ... 
ok
test_construct_singletons (test.test_builtin.BuiltinTest) ... ok
test_delattr (test.test_builtin.BuiltinTest) ... ok
test_dir (test.test_builtin.BuiltinTest) ... ok
test_divmod (test.test_builtin.BuiltinTest) ... ok
test_eval (test.test_builtin.BuiltinTest) ... ok
test_exec (test.test_builtin.BuiltinTest) ... ok
test_exec_globals (test.test_builtin.BuiltinTest) ... ok
test_exec_redirected (test.test_builtin.BuiltinTest) ... ok
test_filter (test.test_builtin.BuiltinTest) ... ok
test_filter_pickle (test.test_builtin.BuiltinTest) ... ok
test_format (test.test_builtin.BuiltinTest) ... ok
test_general_eval (test.test_builtin.BuiltinTest) ... ok
test_getattr (test.test_builtin.BuiltinTest) ... ok
test_hasattr (test.test_builtin.BuiltinTest) ... ok
test_hash (test.test_builtin.BuiltinTest) ... ok
test_hex (test.test_builtin.BuiltinTest) ... ok
test_id (test.test_builtin.BuiltinTest) ... ok
test_import (test.test_builtin.BuiltinTest) ... ok
test_input (test.test_builtin.BuiltinTest) ... ok
test_isinstance (test.test_builtin.BuiltinTest) ... ok
test_issubclass (test.test_builtin.BuiltinTest) ... ok
test_iter (test.test_builtin.BuiltinTest) ... ok
test_len (test.test_builtin.BuiltinTest) ... ok
test_map (test.test_builtin.BuiltinTest) ... ok
test_map_pickle (test.test_builtin.BuiltinTest) ... ok
test_max (test.test_builtin.BuiltinTest) ... ok
test_min (test.test_builtin.BuiltinTest) ... ok
test_neg (test.test_builtin.BuiltinTest) ... ok
test_next (test.test_builtin.BuiltinTest) ... ok
test_oct (test.test_builtin.BuiltinTest) ... ok
test_open (test.test_builtin.BuiltinTest) ... ok
test_open_default_encoding (test.test_builtin.BuiltinTest) ... ok
test_open_non_inheritable (test.test_builtin.BuiltinTest) ... ok
test_ord (test.test_builtin.BuiltinTest) ... ok
test_pow (test.test_builtin.BuiltinTest) ... ok
test_repr (test.test_builtin.BuiltinTest) ... ok
test_round (test.test_builtin.BuiltinTest) ... ok
test_round_large (test.test_builtin.BuiltinTest) ... ok
test_setattr (test.test_builtin.BuiltinTest) ... ok
test_sum (test.test_builtin.BuiltinTest) ... ok
test_type (test.test_builtin.BuiltinTest) ... ok
test_vars (test.test_builtin.BuiltinTest) ... ok
test_warning_notimplemented (test.test_builtin.BuiltinTest) ... ok
test_zip (test.test_builtin.BuiltinTest) ... ok
test_zip_bad_iterable (test.test_builtin.BuiltinTest) ... ok
test_zip_pickle (test.test_builtin.BuiltinTest) ... ok
test_input_no_stdout_fileno (test.test_builtin.PtyTests) ...

== Tests result: FAILURE ==

1 test failed:
test_builtin

Total duration: 1.4 sec
Tests result: FAILURE

System: SunOS gcc-solaris11 5.11 11.3 sun4u sparc SUNW,SPARC-Enterprise
Tested under both gcc (5.5.0) and solaris studio (12)

--
components: Tests
messages: 365505
nosy: BTaskaya
priority: normal
severity: normal
status: open
title: test_builtin crashes when runned in parallel mode on solaris
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



[issue40115] test_asyncio leaked [3, 3, 3] references, sum=9

2020-04-01 Thread Kyle Stanley


Kyle Stanley  added the comment:

I was able to find a fix! Specifically, I think the issue was a subtle problem 
with test_run_in_executor_cancel: it never properly shuts down the executor 
prior to closing the event loop. 

We do this in asyncio.run() (with the loop.shutdown_default_executor() that I 
added last year), but it should be called explicitly when using loop.close() 
directly. Otherwise, the resources of the executor may not be cleaned up 
properly. I think the issue was being covered up because of the usage of daemon 
threads in the ThreadPoolExecutor, but revealed itself when the workers were 
converted to non-daemon threads since they require proper cleanup.

The change is very minimal:

```
def test_run_in_executor_cancel(self):
called = False

def patched_call_soon(*args):
nonlocal called
called = True

def run():
time.sleep(0.05)

f2 = self.loop.run_in_executor(None, run)
f2.cancel()
+  self.loop.run_until_complete(
+  self.loop.shutdown_default_executor())
self.loop.close()
self.loop.call_soon = patched_call_soon
self.loop.call_soon_threadsafe = patched_call_soon
time.sleep(0.4)
self.assertFalse(called)
```

Before change:
```
[aeros:~/repos/aeros-cpython]$ ./python -m test --fail-env-changed -R 3:3 
test_asyncio -m 
test.test_asyncio.test_events.EPollEventLoopTests.test_run_in_executor_cancel
0:00:00 load avg: 0.63 Run tests sequentially
0:00:00 load avg: 0.63 [1/1] test_asyncio
beginning 6 repetitions
123456
..
test_asyncio leaked [1, 1, 1] references, sum=3
test_asyncio leaked [2, 1, 1] memory blocks, sum=4
test_asyncio failed

== Tests result: FAILURE ==

1 test failed:
test_asyncio

Total duration: 3.2 sec
Tests result: FAILURE
```

After change:
```
[aeros:~/repos/aeros-cpython]$ ./python -m test --fail-env-changed -R 3:3 
test_asyncio -m 
test.test_asyncio.test_events.EPollEventLoopTests.test_run_in_executor_cancel
0:00:00 load avg: 0.24 Run tests sequentially
0:00:00 load avg: 0.24 [1/1] test_asyncio
beginning 6 repetitions
123456
..

== Tests result: SUCCESS ==

1 test OK.

Total duration: 3.5 sec
Tests result: SUCCESS
```

I'll also test the PR using the `test-with-buildbots` label to double check, it 
should be attached to this issue within the next couple of hours.

--

___
Python tracker 

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



[issue15140] PEP 384 inconsistent with implementation

2020-04-01 Thread Furkan Onder


Furkan Onder  added the comment:

It fixed.

--
nosy: +furkanonder

___
Python tracker 

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



[issue15140] PEP 384 inconsistent with implementation

2020-04-01 Thread Guido van Rossum


Change by Guido van Rossum :


--
resolution:  -> fixed
stage: needs patch -> 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



[issue40115] test_asyncio leaked [3, 3, 3] references, sum=9

2020-04-01 Thread Kyle Stanley


Change by Kyle Stanley :


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

___
Python tracker 

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



[issue39812] Avoid daemon threads in concurrent.futures

2020-04-01 Thread Kyle Stanley


Kyle Stanley  added the comment:

I attached a PR to bpo-40115 to address the refleak in test_asyncio: PR-19282.

--

___
Python tracker 

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



[issue40141] Add line and column information for keywords in the AST

2020-04-01 Thread Pablo Galindo Salgado


New submission from Pablo Galindo Salgado :

When inspecting keyword parameters in a function call, the keyword is stored as 
a string and not as a AST node:

>>> import ast
>>> r = "f(a,   xxa  =  34, y=23)"
>>> node = ast.parse(r)
>>> ll = node.body[0].value.keywords[0].arg
>>> node.body[0].value.keywords[0].arg
'xxa'

this makes impossible to locate the keyword in the code using the AST as it 
lacks AST attributes (lineno, col_offset, end_lineno, end_col_offset).

On the other hand, this does not happen with args, that has the 
meta-information:

>>> node.body[0].value.args[0].id
'a'
>>> dir(node.body[0].value.args[0])


So one can locate the arg string using:

>>> r[arg.col_offset:arg.end_col_offset]
'a'

For this reason, we should add the same information to keyword nodes.

--
components: Interpreter Core
messages: 365509
nosy: pablogsal
priority: normal
severity: normal
status: open
title: Add line and column information for keywords in the AST
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



[issue40141] Add line and column information for keywords in the AST

2020-04-01 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue40141] Add line and column information for keywords in the AST

2020-04-01 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am preparing more PRs for other nodes that are missing the meta-information 
as well but will open them in a separate issue.

--

___
Python tracker 

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



[issue40140] test_builtin crashes when runned in parallel mode on solaris

2020-04-01 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Try making bigger the stack size (with ulimit -s ... or similar)

--
nosy: +pablogsal

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

> Please open a new issue. This one is closed.

Pablo Galindo opened bpo-40140, let's use this one.

--

___
Python tracker 

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



[issue40140] test_builtin crashes when runned in parallel mode on solaris

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

I modified recently the test:

(1) commit 278c1e159c970da6cd6683d18c6211f5118674cc

-os.waitpid(pid, 0)
+support.wait_process(pid, exitcode=0)

(2) commit 16d75675d2ad2454f6dfbf333c94e6237df36018

Close the fd *after* calling support.wait_process() to prevent sending SIGHUP 
to the child process, which made support.wait_process(pid, exitcode=0) to fail 
since exitcode=-1 (-SIGHUP) != 0.

--

test_builtin.test_input_no_stdout_fileno() also hangs on AIX:
https://bugs.python.org/issue31160#msg365478

--
nosy: +vstinner

___
Python tracker 

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



[issue40140] test_builtin crashes when runned in parallel mode on solaris

2020-04-01 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am understanding "crashing" as "segfaulting"

--

___
Python tracker 

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



[issue40142] Modify _PyObject_GC_TRACK() to ensure that newly tracked object is valid

2020-04-01 Thread STINNER Victor


New submission from STINNER Victor :

In bpo-38392, I modified PyObject_GC_Track() to ensure that the object newly 
tracked is valid: call its traverse function.
=> commit 1b1845569539db5c1a6948a5d32daea381f1e35f

I propose to now also attempt to implement the same check in 
_PyObject_GC_TRACK() which is part of the internal C API.

PyType_GenericAlloc() allocates memory for a type allocated on the heap... and 
then immediately track it in the GC. Problem: this type is not initialized yet, 
all fields are set to zero. Calling type_traverse() at this point fails with an 
assertion error:
---
Objects/typeobject.c:3570: type_traverse: Assertion failed: type_traverse() 
called on non-heap type '(null)'
Enable tracemalloc to get the memory block allocation traceback

object address  : 0x840860
object refcount : 1
object type : 0x7e0900
object type name: type
object repr : 
---

By the way, Python crash in _PyObject_Dump() on PyObject_Repr() call: 
type_repr() crash when accessing type->tp_name which is NULL.

type_call() should only track the newly created type when it's fully 
initialized.


Try attached track.patch to reproduce the crash.

--
components: Interpreter Core
files: track.patch
keywords: patch
messages: 365515
nosy: vstinner
priority: normal
severity: normal
status: open
title: Modify _PyObject_GC_TRACK() to ensure that newly tracked object is valid
type: enhancement
versions: Python 3.9
Added file: https://bugs.python.org/file49021/track.patch

___
Python tracker 

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



[issue40140] test_builtin crashes when runned in parallel mode on solaris

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

> 0:00:01 load avg: 1.70 [1/1/1] test_builtin crashed (Exit code -1)

Exit code -1 looks like a process killed by SIGHUP. Which commit did you try?

Can you please check that you tested with my commit 
16d75675d2ad2454f6dfbf333c94e6237df36018?

--

___
Python tracker 

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



[issue31160] Enhance support.reap_children()

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

> Pablo Galindo opened bpo-40140, let's use this one.

Note: Oops, Batuhan created it, Pablo only commented.

--

___
Python tracker 

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



[issue33493] dataclasses: allow keyword-only arguments

2020-04-01 Thread Chris Barker


Chris Barker  added the comment:

This does not actually appear to be a Duplicate of #33129.

That one was asking to add **kwargs (I think) to the __init__. And was 
discussed and I think rejected on gitHub:

https://github.com/python/cpython/pull/19206

But this calls for having keyword-only parameters, which I think would still be 
a good idea.

--
nosy: +ChrisBarker

___
Python tracker 

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



[issue40024] Add PyModule_AddType helper function

2020-04-01 Thread Kyle Stanley


Change by Kyle Stanley :


--
nosy: +aeros
nosy_count: 3.0 -> 4.0
pull_requests: +18641
pull_request: https://github.com/python/cpython/pull/19282

___
Python tracker 

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



[issue39837] Remove Azure Pipelines from GitHub PRs

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

> Yes, but I don't want to to do that as we have had equivalent flakiness 
> issues with Travis which is why it isn't required ATM.

I'm not aware of Travis CI current issue. There were issues in the past, as 
with any CI, right ;-) Travis CI looks quite reliable these days.

Whereas the Docs and Ubuntu GH Action job of Azure failed to install 
dependencies :-(

--

___
Python tracker 

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



[issue40143] shutil.rmtree will frequently fail on Windows under heavy load due to racy deletion

2020-04-01 Thread Alexander Riccio


New submission from Alexander Riccio :

The "obvious" way to delete a directory tree on Windows is wrong. It's 
inherently racy, since deleting a file on Windows *doesn't actually delete it*, 
instead it marks the file for deletion. The system will eventually get around 
to deleting it, but under heavy load, this might be sometime after an attempt 
is made to delete the parent directory. I've seen this (windows error 145, 
directory is not empty) many times when running the testsuite, and it causes 
all kinds of intermittent failures.

The best way to do things correctly is kinda nuts, and is explained well by 
Niall Douglass here: https://www.youtube.com/watch?v=uhRWMGBjlO8&t=8m54s

In short, the correct way to do it involves moving each file to a randomly 
named file in %TEMP%, then deleting that, and then doing the same with each 
newly-empty directory.

--
components: Windows
messages: 365520
nosy: Alexander Riccio, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: shutil.rmtree will frequently fail on Windows under heavy load due to 
racy deletion
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



[issue40144] test.support.SuppressCrashReport fails on macOS

2020-04-01 Thread STINNER Victor


New submission from STINNER Victor :

Failure seen on the macOS job on a PR:

https://github.com/python/cpython/pull/19252/checks?check_run_id=552502971
of https://github.com/python/cpython/pull/19252/files

Reformatted error:

AssertionError: Regex didn't match:

"Fatal Python error: _enter_buffered_busy: could not acquire lock for 
<(_io\\.)?BufferedWriter name=''> at interpreter shutdown, possibly due 
to daemon threads"

not found in

'Traceback (most recent call last):
  File "", line 15, in 
  File 
"/Users/runner/runners/2.165.2/work/cpython/cpython/Lib/test/support/__init__.py",
 line 2913, in __enter__
self.old_value = resource.getrlimit(resource.RLIMIT_CORE)
AttributeError: module \'resource\' has no attribute \'RLIMIT_CORE\'
'

It seems like resource.RLIMIT_CORE is not available on this macOS machine.

--
components: Tests
messages: 365521
nosy: vstinner
priority: normal
severity: normal
status: open
title: test.support.SuppressCrashReport fails on macOS
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



[issue40024] Add PyModule_AddType helper function

2020-04-01 Thread Kyle Stanley


Change by Kyle Stanley :


--
pull_requests:  -18641

___
Python tracker 

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



[issue40024] Add PyModule_AddType helper function

2020-04-01 Thread Kyle Stanley


Kyle Stanley  added the comment:

(disregard the above, the PR was mistakenly linked from a GitHub bug)

--

___
Python tracker 

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



[issue40144] test.support.SuppressCrashReport fails on macOS

2020-04-01 Thread STINNER Victor


STINNER Victor  added the comment:

> https://github.com/python/cpython/pull/19252/checks?check_run_id=552502971

test.pythoninfo says:

os.uname: posix.uname_result(sysname='Darwin', nodename='Mac-1307.local', 
release='19.4.0', version='Darwin Kernel Version 19.4.0: Wed Mar  4 22:28:40 
PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64', machine='x86_64')

platform.platform: macOS-10.15.4-x86_64-i386-64bit

--

___
Python tracker 

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



  1   2   >