[issue41637] Calling with an infinite number of parameters is not detected

2020-08-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It does not differ much from list(inf()). Sooner or later it will raise 
MemoryError. You can interrupt the execution by pressing Ctrl-C. Although the 
response may be slow if your computer started swapping.

There is nothing special about unpacking infinite number of parameters. You can 
achieve the same result in many other ways in any programming language. If you 
want you program do not use too much swap, limit the virtual memory size by the 
shell ulimit command (or by resource.setrlimit() in Python).

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



[issue41513] High accuracy math.hypot()

2020-08-29 Thread Tim Peters


Tim Peters  added the comment:

About test_frac.py, I changed the main loop like so:

got = [float(expected)] # NEW
for hypot in hypots:
actual = hypot(*coords)
got.append(float(actual)) # NEW
err = (actual - expected) / expected
bits = round(1 / err).bit_length()
errs[hypot][bits] += 1
if len(set(got)) > 1: # NEW
print(got) # NEW

That is, to display every case where the four float results weren't identical.

Result: nothing was displayed (although it's still running the n=1000 chunk, 
there's no sign that will change).  None of these variations made any 
difference to results users actually get.

Even the "worst" of these reliably develops dozens of "good bits" beyond IEEE 
double precision, but invisibly (under the covers, with no visible effect on 
delivered results).

So if there's something else that speeds the code, perhaps it's worth pursuing, 
but we're already long beyond the point of getting any payback for pursuing 
accuracy.

--

___
Python tracker 

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



[issue41246] IOCP Proactor same socket overlapped callbacks

2020-08-29 Thread Jim Jewett


Change by Jim Jewett :


--
stage: patch review -> commit review

___
Python tracker 

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



[issue41533] Bugfix: va_build_stack leaks the stack if do_mkstack fails

2020-08-29 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue41533] Bugfix: va_build_stack leaks the stack if do_mkstack fails

2020-08-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21115
pull_request: https://github.com/python/cpython/pull/22015

___
Python tracker 

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



[issue41533] Bugfix: va_build_stack leaks the stack if do_mkstack fails

2020-08-29 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 75c80b0bda89debf312f075716b8c467d411f90e by Tony Solomonik in 
branch 'master':
closes bpo-41533: Fix a potential memory leak when allocating a stack (GH-21847)
https://github.com/python/cpython/commit/75c80b0bda89debf312f075716b8c467d411f90e


--
nosy: +benjamin.peterson
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



[issue41637] Calling with an infinite number of parameters is not detected

2020-08-29 Thread Camion

Camion  added the comment:

Well, I know an infinite loop  is not necessarily wrong, especially in a 
generator. and I also know how to avoid this problem.
My problem is not there. It's just that I believe it should possibly crash the 
program and not the interpreter. 
I even wonder if being able to cause an interpreter crash couldn't become a 
security hole in some cases.probably the basic solution would be to forward an 
exception to the program if the interpreter running it gets an allocation error.

About core dump or crash report, it didn't generate one but I think I should 
install a few things on the computer to get it.

Le dimanche 30 août 2020 à 02:02:01 UTC+2, Terry J. Reedy 
 a écrit :  

Terry J. Reedy  added the comment:

On Windows, I get an indefinite hang rather than an overt crash with a crash 
box.  I believe that there was some swapping out to disk.  I got the same with 
list(itertools.count()). 

If you got a core dump or crash report, you might upload it.  

There is infinite looping in the argument collection but no infinite recursion 
(calling) here.  The latter is detected pretty quickly because of sys.recursion 
limit.  Infinite loops by themselves are not necessarily wrong.  This typing 
box is run by an infinite loop.  Change your 'use' to

def use(iter):
    for i in iter: print(i)

and there would be no problem.  So I disagree with 'should have been detected'. 
 I am only leaving this open in case you got an overt crash for this particular 
loop.  Those we try to fix.

--
nosy: +terry.reedy
title: Calling a function with an infinite number of parameters is not detected 
and crash the interpreter instead of causing an exception -> Calling with an 
infinite number of parameters is not detected
versions: +Python 3.9

___
Python tracker 

___

--

___
Python tracker 

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



[issue37095] [Feature Request]: Add zstd support in tarfile

2020-08-29 Thread Ma Lin


Ma Lin  added the comment:

I have spent two weeks, almost complete the code, a preview:
https://github.com/animalize/cpython/pull/8/files

Write directly for stdlib, since there are already zstd modules on pypi.
In addition, the API of zstd is simple, not as complicated as lzma.

Can also use these:
1, argument clinic
2, multi-phase init
3. internal function _PyLong_AsInt

--

___
Python tracker 

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



[issue41513] High accuracy math.hypot()

2020-08-29 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +21113
pull_request: https://github.com/python/cpython/pull/22013

___
Python tracker 

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



[issue41513] High accuracy math.hypot()

2020-08-29 Thread Raymond Hettinger


Change by Raymond Hettinger :


Added file: https://bugs.python.org/file49435/best_frac.py

___
Python tracker 

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



[issue41615] sys.argv may be None or an empty list

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

New link works and I read it, including the reference to #839151.

--

___
Python tracker 

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



[issue41615] sys.argv may be None or an empty list

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I just noticed that Py_Initialize "does not set sys.argv; use PySys_SetArgvEx() 
for that."
https://docs.python.org/3/c-api/init.html#c.Py_Initialize
https://docs.python.org/3/c-api/init.html#c.PySys_SetArgvEx
void PySys_SetArgvEx(int argc, wchar_t **argv, int updatepath)

The latter treats failure to initialize sys.argv as fatal.  It suggests that 
embedders might want updatepath = 0.

--

___
Python tracker 

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



[issue41653] About the use of cpython console mode problem

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I am replacing the text snippet screenshot with a link to the online doc:
  https://docs.python.org/3/c-api/init.html#c.Py_Initialize

The only encoding python 'forces' in recent Python is utf-8 in utf-8 mode and 
on some systems.  See 
https://docs.python.org/3/library/sys.html#sys.getfilesystemencoding.  I am 
guessing that you are using *nix and that your locale uses gbk.

I am closing because there is no usable description of a bug.  I suggest asking 
on Python-list about how to do whatever it is you want.  Start with your OS and 
version.

--
nosy: +terry.reedy
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



[issue41653] About the use of cpython console mode problem

2020-08-29 Thread Terry J. Reedy


Change by Terry J. Reedy :


Removed file: https://bugs.python.org/file49430/Screenshot_2020_0828_104656.png

___
Python tracker 

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



[issue41645] Typo First Page of Documentation

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I agree that a second verb might be better but 'is' is wrong.  How about
  Python has ... and uses a simple but effective approach ..

--
nosy: +terry.reedy

___
Python tracker 

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



[issue41637] Calling with an infinite number of parameters is not detected

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

On Windows, I get an indefinite hang rather than an overt crash with a crash 
box.  I believe that there was some swapping out to disk.  I got the same with 
list(itertools.count()). 

If you got a core dump or crash report, you might upload it.  

There is infinite looping in the argument collection but no infinite recursion 
(calling) here.  The latter is detected pretty quickly because of sys.recursion 
limit.  Infinite loops by themselves are not necessarily wrong.  This typing 
box is run by an infinite loop.  Change your 'use' to

def use(iter):
for i in iter: print(i)

and there would be no problem.  So I disagree with 'should have been detected'. 
 I am only leaving this open in case you got an overt crash for this particular 
loop.  Those we try to fix.

--
nosy: +terry.reedy
title: Calling a function with an infinite number of parameters is not detected 
and crash the interpreter instead of causing an exception -> Calling with an 
infinite number of parameters is not detected
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



[issue41634] Typo in curses documentation

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Karthikeyan, I went ahead and merged and closed this trivial fix because I 
could not imagine any reason to hold it up.

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



[issue41634] Typo in curses documentation

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset a1473d2c9106abbdc619bdcc973c15a87e3f0f12 by Miss Islington (bot) 
in branch '3.8':
bpo-41634: Fix a typo in the curses documentation (GH-21958)
https://github.com/python/cpython/commit/a1473d2c9106abbdc619bdcc973c15a87e3f0f12


--
nosy: +terry.reedy

___
Python tracker 

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



[issue41634] Typo in curses documentation

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 6b5e88744cb48156a5dee47244dbc1b0dd82567c by Miss Islington (bot) 
in branch '3.9':
bpo-41634: Fix a typo in the curses documentation (GH-21958)
https://github.com/python/cpython/commit/6b5e88744cb48156a5dee47244dbc1b0dd82567c


--

___
Python tracker 

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



[issue41664] re.sub does NOT substitute all the matching patterns when re.IGNORECASE is used

2020-08-29 Thread Matthew Barnett


Matthew Barnett  added the comment:

The 4th argument of re.sub is 'count', not 'flags'.

re.IGNORECASE has the numeric value of 2, so:

re.sub(r'[aeiou]', '#', 'all is fair in love and war', re.IGNORECASE)

is equivalent to:

re.sub(r'[aeiou]', '#', 'all is fair in love and war', count=2)

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



[issue41629] __class__ not set defining 'X' as

2020-08-29 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: __class__ not set defining 'X' as . Was 
__classcell__ propagated to type.__new__? -> __class__ not set defining 'X' as 


___
Python tracker 

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



[issue41627] Relocate user site packages on Windows 32-bit

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

If it is otherwise possible to user-only install both 32 and 64 bit versions, 
then using the same site-packages strikes me a bug, even if only fixed in the 
next version.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue41622] Add support for emoji-data.txt and emoji-variation-sequences.txt to unicodedata

2020-08-29 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Base facts: The Unicode Character Database, UCD, is defined in Tech Report 44, 
https://www.unicode.org/reports/tr44/.  The latest files (now for 13.0) are at 
https://www.unicode.org/Public/UCD/latest/ and in particular, in the ucd 
subdirectory. ucd/UnicodeData.txt has a sequential list of current codepoints, 
including emoji codepoints.

Version 13 added subdirectly ucd/emoji with the 2 files listed above.  
emoji-variation-sequences.txt comprises 177 highly redundant pairs of lines 
like this:
0023 FE0E  ; text style;  # (1.1) NUMBER SIGN
0023 FE0F  ; emoji style; # (1.1) NUMBER SIGN
The only difference between the lines is 'FE0E; text' versus 'FE0F; emoji', 
'TEXT PRESENTATION SELECTOR' versus 'EMOJI PRESENTATION SELECTOR'.

tr51 does not explicitly say that every line is paired, but perusal suggests 
that this is true, making the file highly redundant.  The 177 characters 
include some non-emoji symbols, like #, and omits most emoji, including SNAKE, 
'\U0001f40d', '' (colored coiled snake). And yet, here, at least in Firefox, 
is the supposedly invalid text snake, '\U0001f40d\ufe0e': '︎' (a flat 
black-only, uncoiled wiggling snake head).  I don't know how '#\ufe0f' might be 
different from plain '#'.

Our UCD copy is accessed via 13 functions in the unicodedata module.  Support 
for the file could consist of a new function, such as 'emoji_text'.  The 
implementation could be 'chr in emoji_text_set', where the latter is the set of 
177 characters.  But given the accidental experiment above with an unauthorized 
sequence, I don't know how useful it would be.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue41664] re.sub does NOT substitute all the matching patterns when re.IGNORECASE is used

2020-08-29 Thread Anit Rajpurohit


New submission from Anit Rajpurohit :

Usage of re flags leads to inconsistent results when 
1. The pattern directly used in re.sub
2. The pattern is re.compile'd and used 

Note 1: Input string is all in the lowercase 'all is fair in love and war'
Note 2: Results are always consistent in case of re.compile'd pattern
===
1. The pattern directly used in re.sub
===
>>> import re
>>> re.sub(r'[aeiou]', '#', 'all is fair in love and war')
'#ll #s f##r #n l#v# #nd w#r'
>>> 
>>> re.sub(r'[aeiou]', '#', 'all is fair in love and war', re.IGNORECASE)
'#ll #s fair in love and war'
>>> 
>>> re.sub(r'[aeiou]', '#', 'all is fair in love and war', 
>>> re.IGNORECASE|re.DOTALL)
'#ll #s f##r #n l#v# #nd w#r'
>>> 
>>> 
===
2. The pattern is re.compile'd and used 
===
>>> pattern = re.compile(r'[aeiou]', re.IGNORECASE)
>>> re.sub(pattern, '#', 'all is fair in love and war')
'#ll #s f##r #n l#v# #nd w#r'
>>> 
>>> pattern = re.compile(r'[aeiou]')
>>> re.sub(pattern, '#', 'all is fair in love and war')
'#ll #s f##r #n l#v# #nd w#r'
>>> 
>>> pattern = re.compile(r'[aeiou]', re.IGNORECASE | re.DOTALL)
>>> re.sub(pattern, '#', 'all is fair in love and war')
'#ll #s f##r #n l#v# #nd w#r'

--
components: Regular Expressions
messages: 376083
nosy: anitrajpurohit28, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: re.sub does NOT substitute all the matching patterns when re.IGNORECASE 
is used
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



[issue41660] multiprocessing.Manager objects lose connection info

2020-08-29 Thread Tim Peters


Tim Peters  added the comment:

Noting that adding a `.join()` to the failing code on the StackOverflow report 
appeared to fix that problem too.

In hindsight, I guess I'm only mildly surprised that letting the main process 
run full speed into interpreter shutdown code while worker processes are still 
running can have bad effects. But I am _somewhat_ surprised. For threads, early 
in shutdown we automatically run a loop to .join() them.

--

___
Python tracker 

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



[issue41246] IOCP Proactor same socket overlapped callbacks

2020-08-29 Thread Tony


Tony  added the comment:

bump

--

___
Python tracker 

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



[issue41533] Bugfix: va_build_stack leaks the stack if do_mkstack fails

2020-08-29 Thread Tony


Tony  added the comment:

bump

--

___
Python tracker 

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



[issue41279] Add a StreamReaderBufferedProtocol

2020-08-29 Thread Tony


Tony  added the comment:

bump

--
title: Convert StreamReaderProtocol to a BufferedProtocol -> Add a 
StreamReaderBufferedProtocol

___
Python tracker 

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



[issue41660] multiprocessing.Manager objects lose connection info

2020-08-29 Thread Tim Peters


Tim Peters  added the comment:

And more weirdness, changing the tail to:

for i in range(10):
state_value.value = i
state_ready.clear()
producerprocess = MyProducer(state_value, state_ready)
consumerprocess = MyConsumer(state_value, state_ready)
producerprocess.start()
consumerprocess.start()
producerprocess.join()
consumerprocess.join()
print(state_value, state_ready.is_set())

That runs fine! All the expected output, and no tracebacks.  But it ALSO runs 
fine if EITHER of the .join() lines is commented out.

--

___
Python tracker 

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



[issue41615] sys.argv may be None or an empty list

2020-08-29 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Thanks Terry.

The correct URL is 
[jaraco/keyring#445](https://github.com/jaraco/keyring/issues/445).

--

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2020-08-29 Thread Spencer Baugh


Spencer Baugh  added the comment:

My mistake, I see now this is just https://bugs.python.org/issue33786 and is 
already fixed.

--

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2020-08-29 Thread Spencer Baugh


Spencer Baugh  added the comment:

I'm not sure this was the correct fix - or at least, this creates further 
issues with asynccontextmanager. Consider the following code:

---
import contextlib
import types

@contextlib.asynccontextmanager
async def acm():
# GeneratorExit athrown here from AsyncContextManager __aexit__,
# propagated from the body of the contextmanager in func()
yield

@types.coroutine
def _yield():
yield

async def func():
async with acm():
# GeneratorExit raised here
await _yield()

x = func()
x.send(None) # start running func
x.close() # raise GeneratorExit in func at its current yield
# AsyncContextManager __aexit__ fails with "RuntimeError: generator didn't stop 
after throw()"
---

The reason for the failure in AsyncContextManager __aexit__ is that the 
asyncgenerator raises StopIteration instead of GeneratorExit when 
agen.athrow(GeneratorExit()) is called and driven, so "await 
agen.athrow(GeneratorExit())" just evaluates to None, rather than raising 
GeneratorExit.

On 3.6 this would work fine, because "await athrow(GeneratorExit())" will raise 
GeneratorExit. I suspect this was broken by this change.

--
nosy: +catern

___
Python tracker 

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



[issue41620] Python Unittest does not return results object when the test is skipped

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

You should justify the proposed change here on the issue, and see if the doc 
says anything about the issue either way.

--
nosy: +ezio.melotti, michael.foord, rbcollins, terry.reedy

___
Python tracker 

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



[issue41615] sys.argv may be None or an empty list

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The docs are normative as well as descriptive.  The specific doc for sys.argv 
is https://docs.python.org/3/library/sys.html#sys.argv.  It says that a proper 
Python stdlib sys module has an args attribute that is a non-empty list whose 
first item is a string.  (It implies, and to me should actually say, that all 
items are strings.)  Since it would seem that it is easy enough to make this 
true, I think that Python code should be able to depend on this as much as 
anything else in the docs.

The 2003 issue 839151 reported that warnings.warn exited with AttributeError 
when accessing a non-existent argv in an embedded interpreter.  I presume that 
the latter was embedded CPython.  AFAIK, the fix could have been to fix 
embedded interpreters to have sys.argv = ['']. (My preference.) Instead, the 
fix, for the warn access only, was to guard the access with try-except 
AttributeError.

The extended fix proposed here is to document that argv is at least optional 
and therefore imply that all access should be wrapped in try-except.

Guido, which idea comports with your idea of 'Python': sys has an argv with at 
least one string (the name, if any, of a 'program'); or sys has an optional 
argv, so that all bullet-proof code must guard access by catching at least 
AttributeError?
---

Notes on a couple of #839151 messages:

1. The fact that one can make argv be missing by deleting it was and is 
irrelevant.  Monkeypatching modules by deleting and changing attributes can 
create unlimited havoc and there is nothing special about sys.argv in this 
regard.

2. "this [patch] should also catch IndexError and TypeError in case sys.argv is 
an empty list or it is not even a list at all."  I consider this similarly 
irrelevant because both of these would, according to the doc, be bugs, whether 
originally present or introduced by monkeypatching.  

https://github.com/pypa/keyring/445 is 404 for me in multiple tries.

--
nosy: +gvanrossum, terry.reedy
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



[issue41610] Any Raspberry Pi Zero Projects to try?

2020-08-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Mika and supriya: this is not a 'forum'.  It is a workspace for discussing 
possible and actual improvements to out githup python/cpython and 
python/devguide repositories via github pull requests.  (Other python 
repositories have their own discussion spaces.)

Most anything python related can be discussed on python-list, mirrored an 
newsgroup gmane.comp.python.general.  This would have been a great question 
there and the answer would have been seen and possibly benefited 1000s, instead 
of just 1 person.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue41663] Support Windows pseudoterminals in pty and termios modules

2020-08-29 Thread Chad Smith

New submission from Chad Smith :

The pty and termios modules do not support Windows. Current Python pty 
documentation suggest Windows might be supported:

> The Linux code is supposed to work on other platforms, but hasn’t been tested 
> yet.

but I have confirmed that it is not while adding pty usage to gdbgui.

The new Windows Psuedo Console, ConPTY, available in Windows 10, now makes this 
possible. 

Proof of existence of a common pty interface for all platforms exists for node 
with the node-pty npm package, which uses ConPTY.


References:

* ConPTY information, 
https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/
* Example ConPTY usage, 
https://github.com/microsoft/terminal/blob/master/samples/ConPTY/EchoCon/EchoCon/EchoCon.cpp
* node-pty, https://github.com/Microsoft/node-pty
* Python pty docs, https://docs.python.org/3/library/pty.html
* gdbgui Windows pty issue, https://github.com/cs01/gdbgui/issues/348

--
messages: 376071
nosy: cs01, steve.dower
priority: normal
severity: normal
status: open
title: Support Windows pseudoterminals in pty and termios modules

___
Python tracker 

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



[issue6721] Locks in the standard library should be sanitized on fork

2020-08-29 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests:  -21110

___
Python tracker 

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



[issue36533] logging regression with threading + fork are mixed in 3.7.1rc2 (deadlock potential)

2020-08-29 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests:  -2

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Stefan Krah  added the comment:

This is in master and 3.9.1.  I'll not backport to 3.8 because a release 
candidate is imminent.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type:  -> behavior
versions: +Python 3.9

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Stefan Krah  added the comment:


New changeset 88b86a9752afc2c50ca196f6ba1a8d62d71cf398 by Miss Islington (bot) 
in branch '3.9':
bpo-19521: Fix parallel build race condition on AIX (GH-22001)
https://github.com/python/cpython/commit/88b86a9752afc2c50ca196f6ba1a8d62d71cf398


--

___
Python tracker 

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



[issue33802] Regression in logging configuration

2020-08-29 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger
nosy_count: 6.0 -> 7.0
pull_requests: +21112
pull_request: https://github.com/python/cpython/pull/21994

___
Python tracker 

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



[issue6721] Locks in the standard library should be sanitized on fork

2020-08-29 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger
nosy_count: 26.0 -> 27.0
pull_requests: +21110
pull_request: https://github.com/python/cpython/pull/21994

___
Python tracker 

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



[issue36533] logging regression with threading + fork are mixed in 3.7.1rc2 (deadlock potential)

2020-08-29 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger
nosy_count: 6.0 -> 7.0
pull_requests: +2
pull_request: https://github.com/python/cpython/pull/21994

___
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-08-29 Thread mohamed koubaa


Change by mohamed koubaa :


--
pull_requests: +21109
pull_request: https://github.com/python/cpython/pull/22003

___
Python tracker 

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



[issue41513] High accuracy math.hypot()

2020-08-29 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 27de28607a248e5ffb8838162fca466a58c2e284 by Raymond Hettinger in 
branch 'master':
bpo-41513: Save unnecessary steps in the hypot() calculation (#21994)
https://github.com/python/cpython/commit/27de28607a248e5ffb8838162fca466a58c2e284


--

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 8.0 -> 9.0
pull_requests: +21107
pull_request: https://github.com/python/cpython/pull/22001

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +21108
pull_request: https://github.com/python/cpython/pull/22002

___
Python tracker 

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



[issue41654] Segfault when raising MemoryError

2020-08-29 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



[issue32642] add support for path-like objects in sys.path

2020-08-29 Thread Roundup Robot


Change by Roundup Robot :


--
nosy: +python-dev
nosy_count: 6.0 -> 7.0
pull_requests: +21106
pull_request: https://github.com/python/cpython/pull/22000

___
Python tracker 

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



[issue41659] PEG discrepancy on 'if {x} {a}: pass'

2020-08-29 Thread Lysandros Nikolaou

Lysandros Nikolaou  added the comment:

I had a look at this. I have been testing with the input a{x}, which faces the 
same problem. 

It's actually because of an invalid_* rule. The call stack looks like this:

...
invalid_comprehension_rule(Parser * p) 
(/home/lysnikolaou/repos/cpython/Parser/parser.c:15065)
genexp_rule(Parser * p) (/home/lysnikolaou/repos/cpython/Parser/parser.c:11381)
primary_raw(Parser * p) (/home/lysnikolaou/repos/cpython/Parser/parser.c:10361)
primary_rule(Parser * p) (/home/lysnikolaou/repos/cpython/Parser/parser.c:10285)
await_primary_rule(Parser * p) 
(/home/lysnikolaou/repos/cpython/Parser/parser.c:10240)
...

The invalid_comprehension rule acecpts an LBRACE as the starting token and only 
fails after it's parsed it, which means that the parser fails with three tokens 
in the tokens array, the NAME which is valid, the LBRACE which is parsed for 
the invalid_comprehension rule and the NAME thereafter, upon which the parser 
fails and backs out of everything. Then, we look at the last token we've parsed 
and that's where we're placing the caret.

Because of invalid_comprehension, we can even go as far as making the parser 
show a completely different error, for example:

➜  cpython git:(master) ✗ cat a.py
a{*x for x in a}
➜  cpython git:(master) ✗ ./python a.py
  File "/home/lysnikolaou/repos/cpython/a.py", line 1
a{*x for x in a}
  ^
SyntaxError: iterable unpacking cannot be used in comprehension

Or place the caret even further:

➜  cpython git:(master) ✗ cat a.py 
a{*x + a + b + c}
➜  cpython git:(master) ✗ ./python a.py
  File "/home/lysnikolaou/repos/cpython/a.py", line 1
a{*x + a + b + c}
^
SyntaxError: invalid syntax

There's a simple fix, which is adding an alternative to the primary rule, that 
parses something along the lines of `primary set` and then call 
RAISE_SYNTAX_ERROR_KNOWN_LOCATION there, but that would have to come before the 
genexp alternative, which worries me because of the performance implications. 
`primary` is a left recursive rule that gets called VERY often, probably more 
than a few times even when parsing a single NAME.

--

___
Python tracker 

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



[issue41658] http.client not allowing non-ascii in headers

2020-08-29 Thread Aliona Matveeva

Aliona Matveeva  added the comment:

hi Karthikeyan Singaravelan!
I'm working with a russian database called 1C. it's pretty popular here in 
Russia, and its 'twist' is that everything there (I mean code) is written in 
Russian, i.e. cyrillic. So it's obvious and normal that the request/response 
coming from 1C base could contain non-ascii characters in its parts. 
Particularly, my case was that the header has a header containing info on 
called method, which value was 
"http://www.1c-bitrix.ru#SVD_ВебСервис:GetEmployee;. which causes the 
"'latin-1' codec cant encode characters in position 29-37: ordinal not in 
range(256)" exception every time I try to send a request there. I tested 
locally, and same happening if I'm trying to add a Cyrillic header when 
creating a request/response in Python.

--

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Stefan Krah  added the comment:


New changeset e6dcd371b2c54a94584dd124e8c592a496d46a47 by Stefan Krah in branch 
'master':
bpo-19521: Fix parallel build race condition on AIX (GH-21997)
https://github.com/python/cpython/commit/e6dcd371b2c54a94584dd124e8c592a496d46a47


--

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Stefan Krah  added the comment:

I can't find the reason for:

if test -z "$EXPORTSYMS"; then
EXPORTSYMS="Modules/python.exp"
fi


Modules/python.exp is hardcoded elsewhere, and I'd rather set
EXPORTSYMS unconditionally on AIX and unset it unconditionally
for all other systems (which don't build with the patch if
EXPORTSYMS happens to be defined).

--

___
Python tracker 

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



[issue41638] Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved

2020-08-29 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue41638] Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved

2020-08-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I agree that the error message should contain the name of the absent parameter 
instead of its index when parameters are supplied as a dict. It is more 
informative and would consistent with other error message.

As for including the number of a record in the error message, I am not sure we 
should do this.

1. For other errors (too large integer, string containing surrogate characters, 
error in custom adapter, etc) the error message does not contain neither 
parameter name nor index. If we want to attach references to parameter and 
record, it is much more larger problem. It may require designing a general 
method for attaching additional information to exceptions and writing a PEP. It 
is a LARGE problem.

2. ProgrammingError is a programming error. In correctly working program you 
should never see such kind of errors, because you are responsible for preparing 
the statement and providing the consistent number of parameter values.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue41662] Bugs in binding parameters in sqlite3

2020-08-29 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue41662] Bugs in binding parameters in sqlite3

2020-08-29 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

There are few bugs in the code for binding parameters specified in the sqlite3 
module:

1. If argument "parameters" is a list, PyList_GET_ITEM() is called in a loop, 
but the size of the list is read only once before loop. Since the list can be 
changed during iteration, it can cause reading past the end of the list.

2. If argument "parameters" is a custom sequence, all exceptions raised in 
__len__() (including KeybordInterrupt) are overridden by a ProgrammingError.

--
components: Extension Modules
messages: 376062
nosy: BTaskaya, ghaering, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Bugs in binding parameters in sqlite3
type: behavior
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

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



[issue41640] module zipfile issue on closing

2020-08-29 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks, I am closing this in favor of issue40564. Jason has provided some 
possible approaches in issue40564 (msg375964) and would be helpful to follow 
the discussion there since it has more details.

--
nosy: +jaraco
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Using zipfile.Path with several files prematurely closes zip

___
Python tracker 

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



[issue41658] http.client not allowing non-ascii in headers

2020-08-29 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Can you please add a short script explaining the problem? There were some 
recent security issues fixed in http.client disallowing non-ascii headers 
issue39603

--
nosy: +xtreak

___
Python tracker 

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



[issue41661] os.path.relpath does not document ValueError on Windows with different drives

2020-08-29 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +Windows
nosy: +eryksun, paul.moore, steve.dower, tim.golden, zach.ware
type:  -> behavior

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Stefan Krah  added the comment:

Okay, thanks.  The -G option is of course attractive for Linux projects
because it requires minimal changes in the build machinery.

I've added support for libmpdec/libmpdec++ (next release) for AIX-style
shared libraries (shr.o inside libmpdec.a).  The AIX linker has a certain
elegance, but it requires something like 150 lines of code changes and
conditionals inside the Makefiles.

I can confirm that -G is substantially slower, so I'm going to commit this
patch soon.

--

___
Python tracker 

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



[issue19521] Parallel build race condition on AIX since python-2.7

2020-08-29 Thread Stefan Krah


Change by Stefan Krah :


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

___
Python tracker 

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



[issue41638] Error message: sqlite3.ProgrammingError: You did not supply a value for binding # might be improved

2020-08-29 Thread Evens Fortuné

Evens Fortuné  added the comment:

Yes we could say that the documentation can be lacking but that doesn't means 
it's a bug in the code. If you feel that the documentation need to be improved 
then you should submit a patch to the documentation and not how the code should 
be changed. 

If you feel that the error message doesn't give enough information you could 
modify the source code of that module and submit a patch instead of a 
workaround.

But meanwhile I would suggest that your code should check that all the 
information is valid before you submit it to the database. It shouldn't be 
really the responsibility of the database to catch this kind of errors.

--

___
Python tracker 

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



[issue41661] os.path.relpath does not document ValueError on Windows with different drives

2020-08-29 Thread Andy Maier


New submission from Andy Maier :

I found that os.path.relpath() on Windows raises ValueError when the path and 
the start path are on different drives. This is to be expected, as there is no 
single root on Windows.

On Python 3.7, the behavior is:

>>> os.path.relpath('c:/abc', 'a:/')
Traceback (most recent call last):
  File "", line 1, in 
  File "...\Python\Python37\lib\ntpath.py", line 564, in relpath
path_drive, start_drive))
ValueError: path is on mount 'c:', start on mount 'a:'

The issue is that this ValueError and the reasons for it are not mentioned at 
all in the documentation for os.path.relpath(). Other os.path functions do 
document specific behaviors for different drives on Windows, for example 
os.path.commonpath(), so there is a precedence for documenting this. Also, it 
should be normal to document the possible exceptions that can be raised.

I did read https://bugs.python.org/issue7195 from 2009 where the original issue 
discussed also lead to a request to update the documentation of 
os.path.relpath() to show the ValueError for this case, but that angle of the 
issue ended up being ignored back then, unfortunately.

My suggestion is to add something like the following sentence the documentation:

"On Windows, ValueError is raised when path and start are on different drives."

--
assignee: docs@python
components: Documentation
messages: 376057
nosy: andymaier, docs@python
priority: normal
severity: normal
status: open
title: os.path.relpath does not document ValueError on Windows with different 
drives
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