[issue46092] Fix/update missing parameters in function signatures for Built-in Functions documentation.

2021-12-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

My understanding is that we're holding off on adding the slash notation to the 
main docs.  The reason is that they are mostly unintelligible to the average 
user.

--
nosy: +rhettinger

___
Python tracker 

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



[issue46081] Document the msg argument for assertRaises

2021-12-15 Thread Eric V. Smith


Change by Eric V. Smith :


--
resolution:  -> wont fix

___
Python tracker 

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



[issue46093] 2D array issue

2021-12-15 Thread Eric V. Smith


Eric V. Smith  added the comment:

problem_ary[:] creates a copy of problem_ary, so it's equal to:

>>> problem_ary[:]
[['a', 'b', 'c'], ['d', 'e', 'f'], ['g', 'h', 'i']]

The [1] element of that is:

>>> problem_ary[:][1]
['d', 'e', 'f']

So this is working as expected.

I suggest you ask on StackOverflow or the python-list mailing list if you need 
more help in understanding how lists work in Python.

--
nosy: +eric.smith
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



[issue46094] Missing unit test on unittest.TestResult to check for required arguments

2021-12-15 Thread dhruv


Change by dhruv :


--
status: open -> pending

___
Python tracker 

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



[issue46094] Missing unit test on unittest.TestResult to check for required arguments

2021-12-15 Thread dhruv


Change by dhruv :


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

___
Python tracker 

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



[issue46094] Missing unit test on unittest.TestResult to check for required arguments

2021-12-15 Thread dhruv


New submission from dhruv :

stream, descriptions, and verbosity seem like they aren't needed at first 
glance but are required to work with multiple inheritance. A simple test can 
clarify this.

--
components: Tests
messages: 408674
nosy: DreamSh0t
priority: normal
severity: normal
status: open
title: Missing unit test on unittest.TestResult to check for required arguments
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

___
Python tracker 

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



[issue46081] Document the msg argument for assertRaises

2021-12-15 Thread Ram Rachum


Ram Rachum  added the comment:

I disagree but I guess I'm in the minority here, so I'll close this issue.

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



[issue46081] Document the msg argument for assertRaises

2021-12-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I concur with Eric that the current presentation is reasonable and better than 
adding boilerplate to every entry.  It suffices that the docs cover the *msg* 
argument once and that each entry includes *msg* in its signature.  

Elsewhere in the docs we also try to avoid unnecessary repetition (for example, 
most classes don't list all their dunder methods).  Excess repetition in the 
docs impairs readability.  The unittest docs are already so long that it 
discourages someone from reading it top to bottom.

--
nosy: +rhettinger

___
Python tracker 

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



[issue46093] 2D array issue

2021-12-15 Thread Ritvik S


New submission from Ritvik S :

I had a problem running the following code. When I ran through what I thought 
python was supposed to do, I got a different answer than what python did. I 
think this is an error. Here is the code:



problem_ary = [['a','b','c'],['d','e','f'],['g','h','i']]
normal_ary = ['a','b','c']

print(normal_ary[:]) #should print ['a','b','c']
print(problem_ary[:][1])



The second output should be ['b','e','h'] since the print statement tells 
python to take [0][1],[1][1], and [2][1] from the problem_ary which is 
'b','e','h'. It confused me when python instead returned ['d','e','f']. I came 
across this problem when I was trying to create tic-tac-toe in python. I tried 
coding this is Python 3.8, 3.9, and using an online interpreter, and I got the 
same result every time.

--
files: 2D-Array-Problem.py
messages: 408671
nosy: ritviksetty
priority: normal
severity: normal
status: open
title: 2D array issue
type: behavior
versions: Python 3.8, Python 3.9
Added file: https://bugs.python.org/file50498/2D-Array-Problem.py

___
Python tracker 

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



[issue46085] OrderedDict iterator allocates di_result unnecessarily

2021-12-15 Thread Inada Naoki


Inada Naoki  added the comment:

Nice catch.

> if ((kind & _odict_ITER_KEYS) && (kind &_odict_ITER_VALUES))

You can reduce one branch by

```
#define _odict_ITER_ITEMS (_odict_ITER_KEYS|_odict_ITER_VALUES)
...
 if (kind & _odict_ITER_ITEMS == _odict_ITER_ITEMS)
```

--
nosy: +methane

___
Python tracker 

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



[issue46082] type casting of bool

2021-12-15 Thread Josh Rosenberg


Josh Rosenberg  added the comment:

Agreed, this is not a bug. The behavior of the bool constructor is not a parser 
(unlike, say, int), it's a truthiness detector. Non-empty strings are always 
truthy, by design, so both "True" and "False" are truthy strings. There's no 
bug to address here.

--
nosy: +josh.r
resolution:  -> not a bug
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue46068] Change use of warnings.warn to logging.warning in a few places

2021-12-15 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Raymond: Makes sense; I didn't know there was disagreement about this. I will 
keep this issue open for a week and then close.

--

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-15 Thread Eric Snow


Eric Snow  added the comment:

If that seems okay, I'll work on a backport PR for 3.10.

--

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-15 Thread Eric Snow


Eric Snow  added the comment:

I've created a PR for moving the interned strings and identifiers to 
_PyRuntimeState until we are ready to move them back to the interpreter.

--

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-15 Thread Eric Snow


Change by Eric Snow :


--
pull_requests: +28350
pull_request: https://github.com/python/cpython/pull/30131

___
Python tracker 

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



[issue46070] _PyImport_FixupExtensionObject() regression causing a crash in subintepreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

Hum, maybe bug.py exposes a different kind of bug. The _asyncio extension uses 
a non-trivial initialize code which doesn't seem to handle well concurrent 
"import _asyncio".

--

___
Python tracker 

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



[issue46091] IndendationError from multi-line indented statements

2021-12-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
Removed message: https://bugs.python.org/msg408657

___
Python tracker 

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



[issue46070] _PyImport_FixupExtensionObject() regression causing a crash in subintepreters

2021-12-15 Thread STINNER Victor


Change by STINNER Victor :


--
title: broken subinterpreters -> _PyImport_FixupExtensionObject() regression 
causing a crash in subintepreters

___
Python tracker 

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



[issue46070] broken subinterpreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

Using attached bug.py, it's possible to trigger the crash on the main branch. I 
modified the reproducer to use the "_asyncio" extension which still uses the 
old API PyModule_Create() with PyModuleDef.m_size = -1.

--
Added file: https://bugs.python.org/file50497/bug.py

___
Python tracker 

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



[issue46091] IndendationError from multi-line indented statements

2021-12-15 Thread Jeremy


Jeremy  added the comment:

Wow, this was a fast turnaround! I was going to spin some cycles on this, but 
would have not seen the solution in 50m.

--

___
Python tracker 

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



[issue46070] broken subinterpreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

I can sometimes reproduce the crash on Windows with Python 3.9. Call stack 
(most recent to oldest frames):

* PyObject_GC_UnTrack() - crash on _PyGCHead_SET_NEXT(prev, next) because prev 
is dangling pointer (0x1fe64dd5250), Visual Studio is unable to read memory
* meth_dealloc() -- delete _sre_compile() method object
* (...)
* PyDict_SetItem() -- set "compile" to None
* _PyModule_ClearDict() -- clear the "_sre" module dict
* _PyModule_Clear()
* _PyImport_Clenaup()
* Py_EndInterpreter()
* (...)
* run_in_subinterp()
* (...)
* t_bootstrap()

The crash occurs in meth_dealloc(), when deallocating the _sre_compile() method 
object stored in _sre module dictionary as the attribute "compile".

The PyGC_Head.prev pointer is a dangling pointer.

On Python 3.9, the "re" module is not imported at startup, but it's imported 
indirectly by "import importlib.util" via "import typing". On Python 3.10, the 
re module is no longer imported by "import importlib.util".

The crash is random. Sometimes, I need 3 or 4 tries. Sometimes, it crash using 
-X dev. Sometimes, it crash immediately. When debugging in Visual Stuido, the 
crash seems easier to reproduce.

On Python 3.9, the _sre exetnsion uses the old API: PyModule_Create() with 
PyModuleDef.m_size = -1.

On Python 3.10, the _sre extension has been converted to multiphase init API: 
PyModuleDef_Init() with PyModuleDef.m_size = sizeof(_sremodulestate). Moreover, 
"import importlib.util" no longer imports indirectly the "re" module.

--

___
Python tracker 

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



[issue46091] IndendationError from multi-line indented statements

2021-12-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

nevermind, I am convinced is a bug. I filed a PR for it

--
stage: patch review -> 

___
Python tracker 

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



[issue46091] IndendationError from multi-line indented statements

2021-12-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Daniel McDonald


Daniel McDonald  added the comment:

For reference, the bug reports with Debian and Ubuntu are at the following URLs:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1001774
https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/1954963

--

___
Python tracker 

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



[issue46092] Fix/update missing parameters in function signatures for Built-in Functions documentation.

2021-12-15 Thread Alex Waygood


Change by Alex Waygood :


--
nosy: +AlexWaygood
versions: +Python 3.11, Python 3.9

___
Python tracker 

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



[issue45829] Remove C stack use by specializing BINARY_SUBSCR, STORE_SUBSCR, LOAD_ATTR, and STORE_ATTR

2021-12-15 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +28348
pull_request: https://github.com/python/cpython/pull/30129

___
Python tracker 

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Daniel McDonald


Daniel McDonald  added the comment:

Thank you, Christian, I apologize for missing your reply. That is great advice, 
and I will do so.

--

___
Python tracker 

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Daniel McDonald


Daniel McDonald  added the comment:

The use of tm_isdst=1 appears to trigger the overflow, and occurs when varying 
other aspects of the timetuple.  

Python's mktime wrapper can throw OverflowError in two places. The thrown error 
is the second location, following the call to glibc's mktime occurring in this 
specific if block:

https://github.com/python/cpython/blob/f62420c3d3f5d87f2b57e54b2a98682bc835f7b6/Modules/timemodule.c#L1038-L1046

Modification of Modules/timemodule.c as to printf tm struct members confirms 
that when tm_isdst=1, the result from mktime() is -1, and the tm_wday member is 
set to -1, the combination of which triggers the conditional. 

mktime within the Github Action ubuntu-latest (20.04) environment is sourced 
from glibc 2.31 as confirmed by ldd and nm on the compiled Python binary.

As a proof of concept, C program was written that calls mktime independent of 
CPython (can be compiled with "gcc bug.c -o bug"). The code below succeeds on 
both OSX 11.6.1 and Centos 7.9:

#include 
#include 

void do_test() {
  struct tm tm_works = { .tm_year=117,
 .tm_mon=4,
 .tm_mday=26,
 .tm_hour=15,
 .tm_min=30,
 .tm_sec=16,
 .tm_wday=4,
 .tm_yday=145,
 .tm_isdst=-1 };
  
  struct tm tm_fails = { .tm_year=117,
 .tm_mon=4,
 .tm_mday=26,
 .tm_hour=15,
 .tm_min=30,
 .tm_sec=16,
 .tm_wday=4,
 .tm_yday=145,
 .tm_isdst=1 };

  time_t works = mktime(_works);
  time_t fails = mktime(_fails);

  if(works == -1) {
  printf("Unexpected failure\n");
  } else {
  if(works == fails) {
  printf("Test passed\n");
  } else {
  printf("Test failed: works=%d; fails=%d\n", (int)works, (int)fails);
  }
  }
}

int main(int argc, char **argv) {
do_test();
}

When compiled and run within in the Github Actions ubuntu-latest (20.04) 
environment, the erroneous behavior occurs:

https://github.com/wasade/cpython/runs/4541212472?check_suite_focus=true#step:17:57

The use of tm_isdst=1 is valid according to multiple sources, a few examples 
are linked below. The sources are consistent, and indicate a positive value 
means Daylight Savings Time is in effect. 

https://www.gnu.org/software/libc/manual/html_node/Broken_002ddown-Time.html
https://www.cplusplus.com/reference/ctime/tm/

At this time, I believe this remains unexpected behavior, however the source 
appears upstream of CPython as mktime is part of glibc. Unless suggested 
otherwise, I'll open an issue with on the glibc tracker.

--

___
Python tracker 

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



[issue46091] IndendationError from multi-line indented statements

2021-12-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Actually, I am not sure if this is a bug, at least according to this comment:

https://bugs.python.org/msg370812

What are your thoughts on this Guido?

--
nosy: +gvanrossum

___
Python tracker 

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



[issue46091] IndendationError from multi-line indented statements

2021-12-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Unfortunately I am not sure if this is going to be easier to retrofit for the 
reasons exposed in the issue. I will try to take a look, but if you have some 
cycles to spare, a PR would be welcomed.

--

___
Python tracker 

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



[issue46092] Fix/update missing parameters in function signatures for Built-in Functions documentation.

2021-12-15 Thread Vivek Vashist


Vivek Vashist  added the comment:

PR: https://github.com/python/cpython/pull/30128

--

___
Python tracker 

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



[issue46092] Fix/update missing parameters in function signatures for Built-in Functions documentation.

2021-12-15 Thread Vivek Vashist


Change by Vivek Vashist :


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

___
Python tracker 

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



[issue46091] IndendationError from multi-line indented statements

2021-12-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This is a side effect on the fix in:

https://bugs.python.org/issue40847

--

___
Python tracker 

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



[issue46092] Fix/update missing parameters in function signatures for Built-in Functions documentation.

2021-12-15 Thread Vivek Vashist


New submission from Vivek Vashist :

Previous issue:

https://github.com/python/cpython/pull/30113#issuecomment-994642493

As noted/pointed by Alex - I went through all the Built-in Functions and 
updated/fixed the missing parameters.

I'll raise a PR shortly.

--
assignee: docs@python
components: Documentation
messages: 408653
nosy: docs@python, vivekvashist
priority: normal
severity: normal
status: open
title: Fix/update missing parameters in function signatures for Built-in 
Functions documentation.
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



[issue46089] Problems with AF_PACKET sockets

2021-12-15 Thread G. Allard


G. Allard  added the comment:

Next 3 steps must be (in decreasing priorities):
- fix the code
- write a mini-howto. It will be used for test purposes
- write documentation (a Howto/tutorial)

For the 3rd step, I would accept to join a team.

--

___
Python tracker 

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



[issue46091] IndendationError from multi-line indented statements

2021-12-15 Thread Jeremy


New submission from Jeremy :

At some point in 3.9 Python appears to have stopped accepting source that 
starts with an indent, then a '\', then the indented statement. From the 
lexical analysis [1] "Indentation cannot be split over multiple physical lines 
using backslashes; the whitespace up to the first backslash determines the 
indentation."

Running the attached program under 3.8.12 I get:
```
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
```

But running under 3.10.0 I get:
```
  File "/Users/jeremyp/tmp/nodent.py", line 3
"""Print a Fibonacci series up to n."""
^
IndentationError: expected an indented block after function definition on line 1
```

Running under 3.9.9 also gives an IndentationError, both with and without -X 
oldparser. So this doesn't seem directly related to the new parser, but seems 
likely it is fall out from the general grammar restructuring.

IMHO it isn't a particularly nice feature for the language to have. Especially 
since not all lines like '\' behave the same. But it was there and 
documented for many years, so should probably be put back. Does a core 
developer agree? That the implementation is not following the spec?

[1]: https://docs.python.org/3/reference/lexical_analysis.html#indentation

--
components: Parser
files: nodent.py
messages: 408651
nosy: lys.nikolaou, pablogsal, ucodery
priority: normal
severity: normal
status: open
title: IndendationError from multi-line indented statements
versions: Python 3.10, Python 3.11, Python 3.9
Added file: https://bugs.python.org/file50496/nodent.py

___
Python tracker 

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



[issue46088] Build hangs under Visual Studio in deepfreeze stage

2021-12-15 Thread Guido van Rossum


Change by Guido van Rossum :


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

___
Python tracker 

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Christian Heimes


Christian Heimes  added the comment:

time.mktime() is a thin wrapper around the libc function mktime(3). I can 
confirm that glibc's mktime() on Debian 11 with glibc 2.31 is failing and 
returning error code -1. Fedora 35 with glibc 2.34, Alpine with musl libc 
1.2.2, and RHEL 8 with glibc 2.28 are working fine.

This suggests that it is not a bug in Python, but Debian-specific platform 
issue. Could you please open a bug with Debian and Ubuntu?

--
nosy: +christian.heimes

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz


Jim Schwartz  added the comment:

Please let me know if you are able to reproduce this issue.

--

___
Python tracker 

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



[issue45959] Teach pprint about dict views

2021-12-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

More accurate to say that it aspires to print in a single line ONLY if the 
content fits in the specified width.  Otherwise, it prints vertically with 
appropriate indentation.  Indeed, that is the entire purpose of the module; 
otherwise, we would just use print() which always writes one line.

--

___
Python tracker 

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



[issue46079] [doc] Broken URL in "Brief Tour of the Standard Library"

2021-12-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This seems to be a temporary outage, expected to be restored in the first half 
of 2022.  Source:  https://www.usno.navy.mil/USNO/time/master-clock

I'll look for an alternative time source that is currently online.

--
assignee: docs@python -> rhettinger
nosy: +rhettinger
priority: normal -> low

___
Python tracker 

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



[issue46090] C extensions can't swap out live frames anymore

2021-12-15 Thread Brandt Bucher


New submission from Brandt Bucher :

I'm specifically concerned about Greenlet here (since it's a dependency of 
pyperformance), but this discussion is equally relevant to any library like it 
that dynamically swaps out the currently executing frame.

CPython 3.11 makes several major changes to how frame objects are used and 
represented internally:

- bpo-44032: Move data stack to thread from FrameObject. 
(https://github.com/python/cpython/pull/26076)
- bpo-44590: Lazily allocate frame objects 
(https://github.com/python/cpython/pull/27077)
- bpo-45637: Store the frame pointer in the cframe 
(https://github.com/python/cpython/pull/29267)

These changes break Greenlet's hot-swapping of frame objects 
(https://github.com/python-greenlet/greenlet/blob/be41e1a24925326b72a02ef5cb6d1ed9643eb062/src/greenlet/greenlet_greenlet.hpp#L768-L811)
 in a pretty serious way, and it's not immediately clear what the best fix is. 
A fairly high-level overview of the new design:

When a frame is executing, the current thread state points to the current 
CFrame, which itself points to a C-level InterpreterFrame. This interpreter 
frame is located within a "data stack" that is managed by the thread state. If 
a PyFrameObject for the currently executing frame is requested (using 
PyThreadState_GetFrame), the new PyFrameObject points into the 
InterpreterFrame, where all of the important data is still stored. So far so 
good.

The issue is what happens next. If the InterpreterFrame is replaced, or exits 
in any way, its memory may be reused, or even freed entirely. The PyFrameObject 
is smart enough to copy the data elsewhere (into itself) when this happens, but 
the new design means that there is no obvious way for a third-party library to 
"reactivate" a frame in a way analogous to assigning to the old tstate->frame 
member.

While I'm pretty sure that we don't officially support this "feature", it's 
probably used often enough that we should at least brainstorm a workaround (if 
not an unstable C-API function) for affected projects. I suspect that a 
potential solution likely involves creating an entirely new InterpreterFrame 
the normal way, and copying the PyFrameObject's InterpreterFrame data into it? 
Not sure what would happen if the old InterpreterFrame was still alive on the 
data stack, though...

In any case, it probably makes sense to discuss here with affected library 
maintainers.

--
assignee: brandtbucher
components: Interpreter Core
messages: 408646
nosy: Mark.Shannon, brandtbucher, gvanrossum, pablogsal
priority: normal
severity: normal
status: open
title: C extensions can't swap out live frames anymore
versions: Python 3.11

___
Python tracker 

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



[issue46085] OrderedDict iterator allocates di_result unnecessarily

2021-12-15 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +eric.snow

___
Python tracker 

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



[issue46086] Add ratio_min() function to the difflib library

2021-12-15 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> tim.peters

___
Python tracker 

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



[issue35844] Calling `Multiprocessing.Queue.close()` too quickly causes intermittent failure (BrokenPipeError)

2021-12-15 Thread jdogzz-g5


Change by jdogzz-g5 :


--
nosy: +jdogzz-g5

___
Python tracker 

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



[issue46089] Problems with AF_PACKET sockets

2021-12-15 Thread Ethan Furman


Ethan Furman  added the comment:

Thank you for the thorough report.  Do you feel comfortable writing that 
missing documentation?

--
nosy: +ethan.furman

___
Python tracker 

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Daniel McDonald


Daniel McDonald  added the comment:

Thank you, Terry. I'm currently exploring modifications to the test Andrei made 
within a fork of CPython using Github Actions (ubuntu-latest). These 
modifications include debug prints in the CPython mktime call, and some 
parameter exploration. I expect to have a summary of the observations this 
afternoon.

--

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz


Jim Schwartz  added the comment:

my c drive and h drive are both internal drives and I run the python script 
from my user directory on my c drive.  Not sure if that makes any difference.  
Just trying to think of things that might help you reproduce and fix this.

--

___
Python tracker 

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Thank you both.  Status: Failures on Open Suse TW (Vyacheslav) and Ubuntu 20-04 
(Daniel McDonald, Github Actions, and Azure Pipelines).
Success on Windows (me), macOS (Catalina-me and 11.6.1-DM), Centos 7.9 and 
Ubuntu 18-04 (both DM) 

I verified that the sample tuple is consistent and round-trips with 
time.localtime.

>>> import time
>>> time.mktime((2017,5,26,15,30,16,4,146,1))
1495827016.0
>>> time.localtime(time.mktime((2017,5,26,15,30,16,4,146,1)))
time.struct_time(tm_year=2017, tm_mon=5, tm_mday=26, tm_hour=15, tm_min=30, 
tm_sec=16, tm_wday=4, tm_yday=146, tm_isdst=1)

While OverflowError is documented as a legitimate response, it is not for a 
contemporary valid datetime such as the above.  Someone with a failure machine 
could try to determine what tuple vales do and don't result in the error.  
Someone with both failure and success machines could add debug prints to mktime 
(or use C debugger) to see where the behavior of the C code diverges on the two 
machines.  If no one active on the issue can do either, a request could be made 
for help on python-list.

--

___
Python tracker 

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



[issue32867] argparse assertion failure with multiline metavars

2021-12-15 Thread Irit Katriel


Irit Katriel  added the comment:

It works for me on 3.11:

% ./python.exe b.py -h
usage: 11 [-h] [-v] 123456
12345
12345
123 [123456
12345
12345
123 ...]

positional arguments:
  123456
12345
12345
123
installation targets

options:
  -h, --helpshow this help message and exit
  -v, --verbose verbose mode

--
nosy: +iritkatriel
resolution:  -> fixed
status: open -> pending

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-15 Thread Eric Snow


Eric Snow  added the comment:

FWIW, it makes sense to me for the interned strings to be per-interpreter 
eventually.
Otherwise strings interned by an interpreter would persist after that 
interpreter
is finalized, potentially leaking memory until the runtime is finalized.

However, if we end up with immortal objects then I think all the strings created
through _Py_IDENTIFIER() should be global (_PyRuntimeState).  Otherwise they 
must
be per-interpreter (if we have a per-interpreter GIL).

--

___
Python tracker 

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



[issue38119] resource tracker destroys shared memory segments when other processes should still have valid access

2021-12-15 Thread jdogzz-g5


Change by jdogzz-g5 :


--
nosy: +jdogzz-g5

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-15 Thread Eric Snow


Eric Snow  added the comment:

It sounds like this bug is another case where we have made some objects
per-interpreter but others are still global and this is causing problems.
_PyUnicode_EqualToASCIIId() wouldn't have any problems if interpreters
weren't sharing any objects (or were only sharing immutable "immortal"
objects).

For now can we just move the relevant per-interpreter strings from
PyInterpreterState.unicode_state ("interned" and "ids") up to
_PyRuntimeState.  They will then be global, which should restore 
the correct behavior.

Personally, I'd rather we not revert the original change.  Moving the data
to _PyRuntimeState would save me some effort with related work I'm doing
right now.

Of course, the potential bug would still exist in _PyUnicode_EqualToASCIIId().
Could we add a test as part of this fix to verify the failure case described
here actually works?

--

___
Python tracker 

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



[issue44999] Argparse missing translates

2021-12-15 Thread Irit Katriel


Change by Irit Katriel :


--
nosy:  -lys.nikolaou
type: performance -> behavior
versions: +Python 3.10, Python 3.11

___
Python tracker 

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



[issue46089] Problems with AF_PACKET sockets

2021-12-15 Thread G. Allard


New submission from G. Allard :

For educational purposes, I'm developing my own IP stack in Python. It's going 
well but I'm stuck at a low level.
I need to implement the following (simple) task:
- open an AF_PACKET socket (socket.socket)
- bind it to a specific interface (socket.bind)
Python code would look like this:
- sock = socket.socket( socket.AF_PACKET, socket.SOCK_RAW, socket.htons( 
ETH_P_ALL))
- sock.setblocking( False)
- sock.bind(( 'eth0', socket.htons( ETH_P_ALL)))
It does not work. bind always return "TypeError: AF_PACKET address must be a 
tuple of two to five elements"
I spent many days on that problem. No success.

Desperate, I tried to verify it wasn't a kernel problem. I wrote the C version 
of the above snippet. 
- sock = socket( AF_PACKET, SOCK_RAW | SOCK_NONBLOCK, htons( 3));
- struct sockaddr_ll addr = {0};
  addr.sll_family = AF_PACKET;
  addr.sll_ifindex = 2;  /* index of 'eth0' */
  addr.sll_protocol = htons( ETH_P_ALL);
- bind( sock, (struct sockaddr*) , sizeof( addr));
I'm not an expert in C programming but it worked on first try.

First problem is that AF_PACKET sockets are broken in Python.

Second problem is inadequate documentation.
Following issue ID 25041, some documentation has been added but there is still 
lot of room for improvements.
For example:
- recvfrom return 2 values. The first is the binary packet and the second one 
is a 5 member structure. The first member of the structure is the interface 
name. The 5th member if the MAC address (assuming the interface is an Ethernet 
NIC). The 3rd one is a protocol number (the data-link protocol) whose data is 
in front of the returnet packet (for WiFi packets, we will see Radiotap 
protocol at that level).
That's a whole new world for documentors.

- socket.bind() parameter is documented to be an address. For AF_PACKET, the 
address is documented in "Socket Families" section. Definition is vague. The 
'proto' description would be easier to understand with "An integer (in 
network-byte-order) representing the low level protocol (enumerated in 
linux/if_ether.h) or ETH_P_ALL for all protocols. This parameter is only used 
for filtering inbound packets."
IMO 'pkttype', 'hatype', 'addr' are there to document the information returned 
by recvfrom(). It's written they are "optional" but I think it's not correct.

- Working examples of AF_PACKET must be provided, possibly in a HOWTO.

When it's easier to program in C, it should tell you there is a problem on 
Python side.

--
assignee: docs@python
components: Documentation
messages: 408638
nosy: docs@python, gallard
priority: normal
severity: normal
status: open
title: Problems with AF_PACKET sockets
type: enhancement
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



[issue22047] Deprecate unsupported nesting of argparse groups

2021-12-15 Thread Irit Katriel


Irit Katriel  added the comment:

Another issue due to nesting: issue38590.

--

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz


Jim Schwartz  added the comment:

when I run the following command:

python "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py" 
"C:\\"

I get this output:

...
Traceback (most recent call last):
  File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", 
line 54, in 
main(sys.argv[0:])
  File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", 
line 30, in main
for file in get_files_in_dir(source):
  File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", 
line 11, in get_files_in_dir
yield from get_files_in_dir(entry.path)
  File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", 
line 11, in get_files_in_dir
yield from get_files_in_dir(entry.path)
  File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", 
line 11, in get_files_in_dir
yield from get_files_in_dir(entry.path)
  [Previous line repeated 19 more times]
  File "H:\Users\LindaJim\Documents\AWS Python Learning\test_dir_scan_dir.py", 
line 9, in get_files_in_dir
for entry in os.scandir(source):
FileNotFoundError: [WinError 3] The system cannot find the path specified: 
'C:\\Users\\Jim\\Documents\\jschw_uiowtv3_old\\AppData\\Local\\Google\\Chrome\\User
 
Data\\Default\\Extensions\\nenlahapcbofgnanklpelkaejcehkggg\\0.1.823.675_0\\notifications\\pages\\Cashback\\components\\CashBackResolve\\components\\RewardsActivation\\components\\CashbackSectionSimple'

when I run the following command:

python "H:\Users\LindaJim\Documents\AWS Python Learning\test_os_walk.py" "C:\\"

I get this:

...
file is  C:\winutils\bin\winutils.exe
End time is  2021-12-15.13:11:54
Duration is  0:06:05

I don't think this should happen, right?

--

___
Python tracker 

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



[issue46088] Build hangs under Visual Studio in deepfreeze stage

2021-12-15 Thread Guido van Rossum


New submission from Guido van Rossum :

I am trying to build under Visual Studio (the 2019 release) and I'm 
encountering the following weird issue. In the project file 
PCbuild\_freeze_module.vcxproj there's a command that runs the 
Tools\scripts\deepfreeze.py script to generate some code.

The invocation is as follows:



Apparently the PythonForBuild variable is unset, because this steps is trying 
to *open* the deepfreeze.py script using the default app for opening .py files, 
which in my case is VS Code.

It seems that when using PCbuild\build.bat, PythonForBuild is set (on line 121) 
to %PYTHON%, which presumably points to some Python interpreter. But apparently 
when the build is driven by VS, this is not executed and now we're stuck.

Is there someone with enough MSBUILD skills to help me fix this?

--
components: Build, Windows
messages: 408635
nosy: gvanrossum, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: Build hangs under Visual Studio in deepfreeze stage
type: compile error
versions: Python 3.11

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz


Jim Schwartz  added the comment:

the issue is with the scandir script, not the os_walk script.  I tried to 
upload the scandir python script before, but I guess it didn't upload.  When I 
was running the two scripts, I used an input of C:\\ as the input parameter.  
Hope that helps.

--
Added file: https://bugs.python.org/file50495/test_dir_scan_dir.py

___
Python tracker 

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



[issue46070] broken subinterpreters

2021-12-15 Thread Ben Steffensmeier


Ben Steffensmeier  added the comment:

We have been seeing intermittent crashes on jep that we tracked down to the 
same change (d0d29655ff).

I have created a sample program using _testcapi that crashes about 50% of the 
time when run on Windows with Python 3.9.9. We have not been able to reproduce 
problems on any other OS.

See also: https://github.com/ninia/jep/issues/366

--
nosy: +bsteffensmeier
Added file: https://bugs.python.org/file50494/win_py399_crash_reproducer.py

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun


Eryk Sun  added the comment:

> but errors in DirEntry.is_dir() and DirEntry.is_symlink() 
> are always ignored

In Windows, is_symlink() won't fail due to a long path, since that information 
comes from the directory listing, but is_dir() might fail for a long path if 
it's a symlink to a directory. Windows requires that a symlink to a directory 
is also a directory (i.e. the symlink reparse point is set on an empty 
directory), but it's not enough to check that it's a directory symlink. 
is_dir() requires checking that the target exists, which may fail if the path 
of the link is too long to open and resolve the link target.

--

___
Python tracker 

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



[issue46070] broken subinterpreters

2021-12-15 Thread Nathan Jensen


Change by Nathan Jensen :


--
nosy: +ndjensen

___
Python tracker 

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



[issue46087] format library documentation error

2021-12-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +eric.smith
resolution:  -> not a bug
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



[issue46087] format library documentation error

2021-12-15 Thread Arthur Milchior


Arthur Milchior  added the comment:

ipypthon3 does not print the loop content. python3 does. I only tested with 
ipython. I beg your pardon. I didn't know about this difference in behavior

--
nosy:  -eric.smith
title: Zip library documentation error -> format library documentation error

___
Python tracker 

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



[issue46087] Zip library documentation error

2021-12-15 Thread Eric V. Smith


Eric V. Smith  added the comment:

Good point, Serhiy. I also don't see how the proposed change is related to any 
zip documentation (which is in the title of this issue).

I suggest closing this.

--
nosy: +eric.smith

___
Python tracker 

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



[issue46086] Add ratio_min() function to the difflib library

2021-12-15 Thread Alex Waygood


Change by Alex Waygood :


--
nosy:  -AlexWaygood

___
Python tracker 

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



[issue46086] Add ratio_min() function to the difflib library

2021-12-15 Thread Alex Waygood


Alex Waygood  added the comment:

I am removing 3.10 from the "versions" field, since additions to the standard 
library are only considered for unreleased versions of Python.

--
nosy: +AlexWaygood, tim.peters
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



[issue46087] Zip library documentation error

2021-12-15 Thread Eric V. Smith


Change by Eric V. Smith :


--
versions:  -Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue46087] Zip library documentation error

2021-12-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Since it is a REPL example, no print() is needed. In REPL any expression 
statement prints the repr of its result. For example:

>>> for x in range(1, 5):
... f'{x}**2 = {x**2}'
... 
'1**2 = 1'
'2**2 = 4'
'3**2 = 9'
'4**2 = 16'

There are many such examples in the documentation, and I do not think that this 
particular example needs a change.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
resolution: works for me -> 
stage: resolved -> needs patch
status: closed -> open
versions: +Python 3.10, Python 3.11 -Python 3.7, Python 3.8

___
Python tracker 

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Confirmed on Ubuntu buildbot:

https://github.com/python/cpython/runs/4537544103?check_suite_focus=true

--

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

os.walk() has been implemented via os.scandir(), but by default it ignores 
OSErrors raised by os.scandir(), DirEntry.is_dir() and DirEntry.is_symlink(). 
You can get errors raised by os.scandir() if specify the onerror argument, but 
errors in DirEntry.is_dir() and DirEntry.is_symlink() are always ignored, so 
too deep directories or links to directories can be treated as files.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun


Eryk Sun  added the comment:

If I had long paths enabled, then next(os.walk(p, onerror=print)) would not 
have printed the error that I showed in the example and would not have 
immediately raised StopIteration. Instead it would have returned a (dirpath, 
dirnames, filenames) result for directory `p`. Did you repeat the simple 
examples that I showed, exactly as shown, and get a different result?

--

___
Python tracker 

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



[issue46087] Zip library documentation error

2021-12-15 Thread Arthur Milchior


Change by Arthur Milchior :


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

___
Python tracker 

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



[issue46087] Zip library documentation error

2021-12-15 Thread Arthur Milchior


New submission from Arthur Milchior :

I don't have permission to assign the issue, but I intend to post the change in 
a few minutes as a PR

Copied from Richard Hyde's email to doc mailing list.

One of the examples of string formatting doesn't work. This applies to prior 
versions of Python as well.

The last set of the examples headed: 'Nesting arguments and more complex 
examples:' starts with the following code:

>>> for align, text in zip('<^>', ['left', 'center', 'right']):
... '{0:{fill}{align}16}'.format(text, fill=align, align=align)
...

This omits print()
The correct code would be:

>>> for align, text in zip('<^>', ['left', 'center', 'right']):
... print('{0:{fill}{align}16}'.format(text, fill=align, align=align))
...



---

I agree with Richard here that there is a problem. Most example don't use 
print, but since there is no returned expression, that's the most relevant way 
to express the meaning of the example. Adding an expression would just make 
things more complex.

Bug introducde in 28fbea412819f90698527c1997ece5aeddf8e9a7 in 2010.

--
assignee: docs@python
components: Documentation
messages: 408624
nosy: Arthur-Milchior, docs@python
priority: normal
severity: normal
status: open
title: Zip library documentation error
type: behavior
versions: Python 3.10, Python 3.11, Python 3.6, 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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz


Jim Schwartz  added the comment:

do you have this registry entry set to 1: 
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled 
set to 1.  It works if you do.  What version of windows do you have?  I have 
version 21H2 (OS Build 19044.1387).  I don't have windows 11 yet.

--

___
Python tracker 

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



[issue46086] Add ratio_min() function to the difflib library

2021-12-15 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue46086] Add ratio_min() function to the difflib library

2021-12-15 Thread Giacomo


New submission from Giacomo :

Here I propose a new function, namely .ratio_min(self,m). 

.ratio_min(self,m) is an extension of the difflib's function .ratio(self). 
Equivalently to .ratio(self), .ratio_min(self,m) returns a measure of two 
sequences' similarity (float in [0,1]). In addition to .ratio(), it can ignore 
matched substrings if these substrings have length less than a given threshold 
m. m is the second variable of the function. 

It is very useful to avoid spurious high similarity scores. 

# NEW FUNCTION: 

def ratio_min(self,m):
"""Return a measure of the sequences' similarity (float in [0,1]).
Where T is the total number of elements in both sequences, and
M_min is the number of matches with every single match has length at 
least m, this is 2.0*M_min / T.
Note that this is 1 if the sequences are identical, and 0 if
they have no substring of length m or more in common.
.ratio_min() is similar to .ratio(). 
.ratio_min(1) is equivalent to .ratio().

>>> s = SequenceMatcher(None, "abcd", "bcde")
>>> s.ratio_min(1)
0.75
>>> s.ratio_min(2)
0.75
>>> s.ratio_min(3)
0.75
>>> s.ratio_min(4)
0.0
"""

matches = sum(triple[-1] for triple in self.get_matching_blocks() if 
triple[-1] >=m)
return _calculate_ratio(matches, len(self.a) + len(self.b))

--
components: Library (Lib)
messages: 408622
nosy: gibu
priority: normal
severity: normal
status: open
title: Add ratio_min() function to the difflib library
type: enhancement
versions: Python 3.10, Python 3.11

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun


Eryk Sun  added the comment:

It works as expected for me:

>>> len(p)
261
>>> print(p)
C:\Temp\Jim\Documents\jschw_uiowtv3_old\AppData\Local\Google\Chrome\User 
Data\Default\Extensions\nenlahapcbofgnanklpelkaejcehkggg\0.1.823.675_0\notifications\pages\Cashback\components\CashBackResolve\components\RewardsActivation\components\CashbackSectionSimple

os.walk() can list the files in directory `p` if the \\?\ prefix is prepended:

>>> next(os.walk('?\\' + p))[-1]
['spam.txt']

Without the prefix, the internal os.scandir() call fails, but by default the 
error is ignored:

>>> next(os.walk(p))[-1]
Traceback (most recent call last):
  File "", line 1, in 
StopIteration

We can print the exception to see that it's the expected ERROR_PATH_NOT_FOUND 
(3) error for a path that's too long:

>>> next(os.walk(p, onerror=print))[-1]
[WinError 3] The system cannot find the path specified: 
'C:\\Temp\\Jim\\Documents\\jschw_uiowtv3_old\\AppData\\Local\\Google\\Chrome\\User
 
Data\\Default\\Extensions\\nenlahapcbofgnanklpelkaejcehkggg\\0.1.823.675_0\\notifications\\pages\\Cashback\\components\\CashBackResolve\\components\\RewardsActivation\\components\\CashbackSectionSimple'
Traceback (most recent call last):
  File "", line 1, in 
StopIteration

--

___
Python tracker 

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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
pull_requests: +28343
pull_request: https://github.com/python/cpython/pull/30124

___
Python tracker 

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



[issue41682] [Windows] test_asyncio: Proactor test_sendfile_close_peer_in_the_middle_of_receiving failure

2021-12-15 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

Mark: "As Victor points out, there is no bug in 3.9 because interned strings 
are common across all interpreter. We should revert that behavior."

The rationale for having per-interpreter interned strings and per-interpreter 
_Py_IDENTIFIER() string objects can be found in bpo-39465 and bpo-40521.

--

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz


Jim Schwartz  added the comment:

yes, I do.  
C:\Users\Jim\Documents\jschw_uiowtv3_old\AppData\Local\Google\Chrome\User 
Data\Default\Extensions\nenlahapcbofgnanklpelkaejcehkggg\0.1.823.675_0\notifications\pages\Cashback\components\CashBackResolve\components\RewardsActivation\components\CashbackSectionSimple

it's over the 260 character limit that's the default for windows 10.

--

___
Python tracker 

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



[issue46072] Unify handling of stats in the CPython VM

2021-12-15 Thread Christian Heimes


Christian Heimes  added the comment:

Could you please add the new option to Doc/using/configure.rst ?

--
nosy: +christian.heimes

___
Python tracker 

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



[issue46085] OrderedDict iterator allocates di_result unnecessarily

2021-12-15 Thread Alex Waygood


Change by Alex Waygood :


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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Eryk Sun


Eryk Sun  added the comment:

> Python 3.9.6 scan_dir returns filenotfound on long paths, 
> but os_walk does not.

This would be surprising. os.walk() has been implemented via os.scandir() since 
Python 3.5. Do you have a concrete example of the directory structure to test? 

> I see that many people on the internet have said to 
> change the working directory as a work around.  

Changing the working directory is a workaround in Unix, not Windows. Without 
long-path support, the working directory in Windows is limited to 258 (MAX_PATH 
- 2) characters.

Without long-path support, the workaround in Windows is to use an extended 
path, i.e. a Unicode path that's fully-qualified and normalized -- as returned 
by os.path.abspath() -- and prefixed by "?\\" or "?\\UNC\\" (e.g. 
r"\\?\C:\spam" or r"\\?\UNC\server\share\spam"). This allows the native path 
length limit of about 32760 characters. Some API functions and applications do 
not support extended paths. In particular setting an extended path as the 
working directory is unsupported and buggy, even if long-path support is 
enabled. But extended paths work fine with most file functions in the os and 
shutil modules, such as os.scandir(), os.stat(), os.open(), shutil.copytree(), 
and shutil.rmtree().

--
nosy: +eryksun

___
Python tracker 

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



[issue46085] OrderedDict iterator allocates di_result unnecessarily

2021-12-15 Thread Kevin Shweh


New submission from Kevin Shweh :

The OrderedDict iterator caches a di_result tuple for use with 
iter(od.items()). It's *supposed* to only do that for the items() case, but the 
code does

if (kind & (_odict_ITER_KEYS | _odict_ITER_VALUES))

to test for this case. This is the wrong test. It should be

if ((kind & _odict_ITER_KEYS) && (kind &_odict_ITER_VALUES))

The current test allocates di_result for key and value iterators as well as 
items iterators.

--
components: Library (Lib)
messages: 408616
nosy: Kevin Shweh
priority: normal
severity: normal
status: open
title: OrderedDict iterator allocates di_result unnecessarily
type: resource usage
versions: Python 3.10, Python 3.11, 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



[issue44413] OverflowError: mktime argument out of range after 2019

2021-12-15 Thread Daniel McDonald


Daniel McDonald  added the comment:

I'd like to politely request this issue be reopened. 

We recently observed a similar, if not the same, OverflowError during 
continuous integration using Github Actions on ubuntu-latest (20.04). We can 
produce the error using pure Python without pytz.

We have been unable to replicate the error using Github Actions on 
macos-latest, Centos 7.9, Ubuntu 18.04 or OSX 11.6.1.

Specifically, the following code, which I believe is pure python, will trigger 
the overflow. We've observed this using Python 3.7 and 3.9. 

import time
print(time.mktime((2017,5,26,15,30,16,4,146,1)))

Exact error output from CI can be found at the link below: 

https://github.com/biocore/microsetta-private-api/runs/4536611219?check_suite_focus=true#step:4:117

On a passing system, we receive "1495837816.0" as output. On a failing system, 
we observe "OverflowError: mktime argument out of range". 

More detail can be found on our issue with pytz and stub42 who helped guide a 
more definitive example of the bug showing it could be pure Python. That issue 
can be found here:

https://github.com/stub42/pytz/issues/66

Last, I apologize in advance if any detail is missing here or if this is not 
formatted as well as it should be. This is my first bug report with Python and 
am unfamiliar with the norms. Please let me know if further information may be 
helpful.

--
nosy: +wasade
versions: +Python 3.7, Python 3.9

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-15 Thread Mark Shannon


Mark Shannon  added the comment:

The problem here is that different sub-interpreters have different strings for 
the same Python string.

Unless sub-interpreters are fully independent, and they cannot be due to 
limitations imposed by the stable API, then all sub-interpreters must share the 
same poll of strings.

Since the only object reachable from a string is the `str` object (which is a 
static global object `PyUnicode_Type`), then the invariant that no object that 
is unique to one sub-interpreter can be reached from another sub-interpreter 
remains valid if strings are shared. I.e. there is no reason not to share 
strings.

As Victor points out, there is no bug in 3.9 because interned strings are 
common across all interpreter. We should revert that behavior.

--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue46072] Unify handling of stats in the CPython VM

2021-12-15 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 342b93f9f28746abb7b221a61d5a9b26ccbb395a by Mark Shannon in 
branch 'main':
bpo-46072: Add --with-pystats configure option to simplify gathering of VM 
stats (GH-30116)
https://github.com/python/cpython/commit/342b93f9f28746abb7b221a61d5a9b26ccbb395a


--

___
Python tracker 

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



[issue41682] [Windows] test_asyncio: Proactor test_sendfile_close_peer_in_the_middle_of_receiving failure

2021-12-15 Thread Ken Jin


Ken Jin  added the comment:

Happened to a PR I was reviewing today:
https://github.com/python/cpython/runs/4535247255?check_suite_focus=true

--
keywords:  -patch
nosy: +kj
versions: +Python 3.11

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-46070: I don't know if it's related.

--

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

These bug prevent the Fedora infra team from upgrading the Koji builders to 
Fedora 35. Koji runs on mod_wsgi which is affected by the bug:
https://bugzilla.redhat.com/show_bug.cgi?id=2030621#c1

--

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz


Jim Schwartz  added the comment:

Here's the second file that works just fine under python 3.9 (by the way, I am 
using Windows 64-bit).  I didn't test this on later python versions, however, 
nor did I test it on 32-bit versions.  I see that many people on the internet 
have said to change the working directory as a work around.  Could this 
possibly be why?

--
Added file: https://bugs.python.org/file50493/test_os_walk.py

___
Python tracker 

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



[issue44525] Implement CALL_FUNCTION adaptive interpreter optimizations

2021-12-15 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 3a60bfef49b3324660a615a8e6d10710e5f669d9 by Mark Shannon in 
branch 'main':
bpo-44525: Specialize for calls to type and other builtin classes with 1 
argument. (GH-29942)
https://github.com/python/cpython/commit/3a60bfef49b3324660a615a8e6d10710e5f669d9


--

___
Python tracker 

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



[issue46080] argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help specified raises exception

2021-12-15 Thread Irit Katriel


Change by Irit Katriel :


--
title: argparse.BooleanOptionalAction with default=argparse.SUPPRESS and help 
specified crashes -> argparse.BooleanOptionalAction with 
default=argparse.SUPPRESS and help specified raises exception

___
Python tracker 

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



[issue46084] Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not

2021-12-15 Thread Jim Schwartz


New submission from Jim Schwartz :

Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk does not. 
 I've enclosed sample scripts that compare the two and have returned the 
results.  the windows 10 registry entry to extend the path names fixes this 
issue 
(HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled
 set to 1).  I've enclosed a scripts that proved this occurs and can be used 
for testing. I have a script that does the same thing using os_walk, but I 
can't attach two scripts to this Issue.

--
components: IO, Tests, Windows
files: test_dir_scan_dir.py
messages: 408607
nosy: jschwar313, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Python 3.9.6 scan_dir returns filenotfound on long paths, but os_walk 
does not
type: crash
versions: Python 3.9
Added file: https://bugs.python.org/file50492/test_dir_scan_dir.py

___
Python tracker 

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



[issue40533] [subinterpreters] Don't share Python objects between interpreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

Until all Python stdlib C extensions and all third-party C extensions will be 
modified to no longer use and define static types and will stop shared Python 
objects between two interpreters, we can no longer micro-optimize the 
comparison of two interned strings by only comparing their memory addresse. See 
bpo-46006.

--

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-15 Thread STINNER Victor


STINNER Victor  added the comment:

I created PR 30123 to fix _PyUnicode_EqualToASCIIId() and type update_slot() 
functions. I added comments explaining why we can no longer optimize the 
comparison of two interned string objects.

--

___
Python tracker 

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



[issue46006] [subinterpreter] _PyUnicode_EqualToASCIIId() issue with subinterpreters

2021-12-15 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +28342
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/30123

___
Python tracker 

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



  1   2   >