[issue18233] SSLSocket.getpeercertchain()

2020-01-30 Thread Kent Watsen


Kent Watsen  added the comment:

It seems that we're talking about the same thing, but I want the cert-chain the 
peer sent without any smarts, exactly how OpenSSL's SSL_get_peer_cert_chain() 
works and, importantly, without stapling any root chain certs the client did 
not send itself (though it's okay if the client did, in which case those certs 
should be included).

I'm not following your "I pass the chain [A, leaf cert]" comment, if leaf-cert 
is signed by B, then this should obviously fail.  Maybe you meant to say that A 
and B are loaded into a bag and that validation test is [bag, leaf-cert]?

Regardless, I don't think Python should coddle developers.  Assuming the docs 
are accurate, competent developers with crypto-clue will be fine.  Many crypto 
library docs encourage tourists to stay away.   That said, if smarts are 
wanted, let's choose a name that doesn't overlap with the existing OpenSSL 
name...get_authed_cert_chain() ?

But, please, can a "peer_cert_chain()" wrapping the OpenSSL call be release 
ASAP, buying time to ponder the merits of smart calls for another day?

--

___
Python tracker 

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



[issue38792] IDLE calltips may not properly close on KeyboardInterrupt

2020-01-30 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

On the issue, Tal pointed out that SyntaxError leaves a calltip after a new >>> 
prompt.  Also fixed.

--

___
Python tracker 

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



[issue39401] [CVE-2020-8315] Unsafe dll loading in getpathp.c on Win7

2020-01-30 Thread Ned Deily


Change by Ned Deily :


--
priority: deferred blocker -> 
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue38792] IDLE calltips may not properly close on KeyboardInterrupt

2020-01-30 Thread miss-islington


miss-islington  added the comment:


New changeset 83d3202b92fb4c2fc6df5b035d57f3a1cf715f20 by Miss Islington (bot) 
in branch '3.8':
bpo-38792: Remove IDLE shell calltip before new prompt. (GH-17150)
https://github.com/python/cpython/commit/83d3202b92fb4c2fc6df5b035d57f3a1cf715f20


--

___
Python tracker 

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



[issue39504] inspect.signature throws RuntimeError on select.epoll.register

2020-01-30 Thread Shantanu


New submission from Shantanu :

>From the documentation of `inspect.signature` it seems we should never have a 
>RuntimeError:
```
Raises ValueError if no signature can be provided, and TypeError if that type 
of object is not supported.
```

The easiest thing to do is just turn the RuntimeError into a ValueError... but 
I'll take a deeper look and see if I can actually fix this.

Traceback below:
```
>>> import sys
>>> sys.version
'3.8.0 (default, Nov 14 2019, 22:29:45) \n[GCC 5.4.0 20160609]'
>>> import inspect
>>> import select
>>> inspect.signature(select.epoll.register)
Traceback (most recent call last):
  File "/usr/lib/python3.8/inspect.py", line 2004, in wrap_value
value = eval(s, module_dict)
  File "", line 1, in 
NameError: name 'EPOLLIN' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/python3.8/inspect.py", line 2007, in wrap_value
value = eval(s, sys_module_dict)
  File "", line 1, in 
NameError: name 'EPOLLIN' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.8/inspect.py", line 3093, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  File "/usr/lib/python3.8/inspect.py", line 2842, in from_callable
return _signature_from_callable(obj, sigcls=cls,
  File "/usr/lib/python3.8/inspect.py", line 2296, in _signature_from_callable
return _signature_from_builtin(sigcls, obj,
  File "/usr/lib/python3.8/inspect.py", line 2109, in _signature_from_builtin
return _signature_fromstr(cls, func, s, skip_bound_arg)
  File "/usr/lib/python3.8/inspect.py", line 2057, in _signature_fromstr
p(name, default)
  File "/usr/lib/python3.8/inspect.py", line 2039, in p
default_node = RewriteSymbolics().visit(default_node)
  File "/usr/lib/python3.8/ast.py", line 360, in visit
return visitor(node)
  File "/usr/lib/python3.8/ast.py", line 445, in generic_visit
new_node = self.visit(old_value)
  File "/usr/lib/python3.8/ast.py", line 360, in visit
return visitor(node)
  File "/usr/lib/python3.8/ast.py", line 445, in generic_visit
new_node = self.visit(old_value)
  File "/usr/lib/python3.8/ast.py", line 360, in visit
return visitor(node)
  File "/usr/lib/python3.8/inspect.py", line 2031, in visit_Name
return wrap_value(node.id)
  File "/usr/lib/python3.8/inspect.py", line 2009, in wrap_value
raise RuntimeError()
RuntimeError
```

--
components: Library (Lib)
messages: 361089
nosy: hauntsaninja
priority: normal
severity: normal
status: open
title: inspect.signature throws RuntimeError on select.epoll.register

___
Python tracker 

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



[issue38792] IDLE calltips may not properly close on KeyboardInterrupt

2020-01-30 Thread miss-islington


miss-islington  added the comment:


New changeset 8d021140866d050f90a4b44c2607f21be43208c1 by Miss Islington (bot) 
in branch '3.7':
bpo-38792: Remove IDLE shell calltip before new prompt. (GH-17150)
https://github.com/python/cpython/commit/8d021140866d050f90a4b44c2607f21be43208c1


--
nosy: +miss-islington

___
Python tracker 

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



[issue39401] [CVE-2020-8315] Unsafe dll loading in getpathp.c on Win7

2020-01-30 Thread Ned Deily


Ned Deily  added the comment:


New changeset 51332c467ed2e07a191f903d554d0c54248e4d88 by Steve Dower in branch 
'3.6':
[3.6] bpo-39401: Avoid unsafe DLL load on Windows 7 and earlier (GH-18231) 
(GH-18233)
https://github.com/python/cpython/commit/51332c467ed2e07a191f903d554d0c54248e4d88


--

___
Python tracker 

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



[issue38792] IDLE calltips may not properly close on KeyboardInterrupt

2020-01-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17661
pull_request: https://github.com/python/cpython/pull/18287

___
Python tracker 

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



[issue38792] IDLE calltips may not properly close on KeyboardInterrupt

2020-01-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17662
pull_request: https://github.com/python/cpython/pull/18288

___
Python tracker 

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



[issue38792] IDLE calltips may not properly close on KeyboardInterrupt

2020-01-30 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset bfdeaa37b3df7466624c17f9450d2bd1c3d95edf by Zackery Spytz in 
branch 'master':
bpo-38792: Remove IDLE shell calltip before new prompt. (#17150)
https://github.com/python/cpython/commit/bfdeaa37b3df7466624c17f9450d2bd1c3d95edf


--

___
Python tracker 

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



[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

2020-01-30 Thread Tim Peters


Tim Peters  added the comment:

Raymond, there was a thread a while back about adding an `imath` module, to 
package the number-theoretic functions that frequently come up.  _All_ these 
things should really go into that instead, IMO.  `math` started as a thin 
wrapper around C's libm, and has been losing its once-exclusive focus on 
functions for working with Python floats.  I think that focus was valuable.

In that older thread, I suggested a `probable_prime(n)` predicate function, and 
posted my pure-Python Miller-Rabin implementation.  Simple (as such things go), 
but I wouldn't aim to compete with (say) gmp.

I don't think `is_prime(n)` is suitable for Python.  Proving that a large 
integer absolutely is prime is either quite slow or quite complicated.  In 
practice, even professionals in critical applications are happy to settle for 
probabilistic assurances, because an arbitrarily tiny probability of error can 
be obtained very much faster than a deterministic proof.

Anyway ;-) , ya, I like the idea, but I'd sure like it to go into a module 
where it obviously belongs.  Also a function, e.g., to generate primes, and ...

--

___
Python tracker 

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



[issue18233] SSLSocket.getpeercertchain()

2020-01-30 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

> For the concern issue, as I understand it, the ability to call getpeercert() 
> or the proposed getpeercertchain() is only after the TLS session has been 
> established.  As such, the SSL socket already established that there exists a 
> valid chain of trust.  Thus these methods are primarily to provide visibility 
> into what the peer passed *after* it had been authenticated, right?

The issue is that "the cert chain provided by the client" and "the cert chain 
that was validated as trustworthy" might be different. For example, say you 
have trust roots A and B, and I have a leaf certificate with a valid signature 
by B. If I pass the chain [A, leaf cert], then openssl's trust validation code 
might look at that and say "yep, this leaf cert is signed by root B, I trust 
root B, cool, the connection is good. Also there's a random A cert here, but 
whatever, that doesn't change anything".

In this case, for your use case, you want to get back the chain [B, leaf cert], 
because that's the chain that was actually validated. If you instead got the 
chain the client gave you, then you might be fooled into thinking that this 
cert chained to root A, when it actually didn't, and make the wrong trust 
decision.

That's why we need to be careful to distinguish between these two possible 
chains.

--

___
Python tracker 

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



[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

2020-01-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Perhaps add, is_prime() as well.  Conceptually, it is in the same family of 
functions.  Unlike lcm(), it is one that I would use and would improve Python's 
value as a teaching tool.

--

___
Python tracker 

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



[issue39487] Merge duplicated _Py_IDENTIFIER identifiers in C code

2020-01-30 Thread Brett Cannon


Brett Cannon  added the comment:

I just merged Hai Shi's PR, so I'm going to close assuming that took care of 
all the instances.

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



[issue39487] Merge duplicated _Py_IDENTIFIER identifiers in C code

2020-01-30 Thread Brett Cannon


Brett Cannon  added the comment:


New changeset 46874c26ee1fc752e2e6930efa1d223b2351edb8 by Hai Shi in branch 
'master':
bpo-39487: Merge duplicated _Py_IDENTIFIER identifiers in C code (GH-18254)
https://github.com/python/cpython/commit/46874c26ee1fc752e2e6930efa1d223b2351edb8


--
nosy: +brett.cannon

___
Python tracker 

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



[issue39503] [security][CVE-2020-8492] Denial of service in urllib.request.AbstractBasicAuthHandler

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

CVE-2020-8492 has been assigned to this vulnerability:
https://cve.mitre.org/cgi-bin/cvename.cgi?name=2020-8492

--
title: [security] Denial of service in urllib.request.AbstractBasicAuthHandler 
-> [security][CVE-2020-8492] Denial of service in 
urllib.request.AbstractBasicAuthHandler

___
Python tracker 

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



[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

2020-01-30 Thread Tim Peters


Tim Peters  added the comment:

And I in turn agree with everything Mark said ;-)  But I'll add that while the 
analogy to comb/perm is a good one, I think the case for lcm is stronger than 
for perm.  Not only is lcm more common in real life (although, no, not at all 
common overall!), perm was added at the same time as prod, and perm is 
essentially a special case of prod.

--

___
Python tracker 

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



[issue39500] Document PyUnicode_IsIdentifier() function

2020-01-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is not convenient to check the result for error. After we remove support of 
old PyUnicode API, PyUnicode_IsIdentifier() will be always succeeded.

Note that PyUnicode_IsIdentifier() still can crash if you pass a non-PyUnicode 
object or NULL. It is a prerequisite of this function that the argument must be 
a PyUnicode object. Add just yet one condition: it must be a ready PyUnicode 
object.

--

___
Python tracker 

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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-30 Thread Martin Panter


Martin Panter  added the comment:

Thanks Victor

--

___
Python tracker 

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



[issue39483] Proposial add loop parametr to run in asyncio

2020-01-30 Thread Андрей Казанцев

Андрей Казанцев  added the comment:

@asvetlov, I provided an example where else this useful feature would be. What 
do you think?

--

___
Python tracker 

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



[issue18233] SSLSocket.getpeercertchain()

2020-01-30 Thread Kent Watsen


Kent Watsen  added the comment:

I don't understand the concern issues being raised for this patch, and also may 
have a use-case not mentioned yet.

For the concern issue, as I understand it, the ability to call getpeercert() or 
the proposed getpeercertchain() is only after the TLS session has been 
established.  As such, the SSL socket already established that there exists a 
valid chain of trust.  Thus these methods are primarily to provide visibility 
into what the peer passed *after* it had been authenticated, right?

That said, the reason I want to access the entire certificate chain passed by 
the client (i.e., client cert auth) is in order to validate that the client's 
cert (which may include some intermediates) authenticates to a specific trust 
anchor, rather than the bag of trust anchors loaded into the SSLContext (via 
load_verify_locations()) in order to authenticate a multiplicity of clients, 
each potentially leading to a different trust anchor.  

Not having getpeercertchain() means that all no client cert may contain a 
chain, i.e., the clients only ever transmit the end-entity cert itself.  This 
is unfortunate because the underlying SSL socket actually allows clients to 
send chains, it's just the lack being able to access the peercertchain in my 
code that seems to limit the solution.

--
nosy: +kwatsen

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2020-01-30 Thread Skip Montanaro


Skip Montanaro  added the comment:

I think to avoid compiler warnings about 'save' perhaps being used 
uninitialized, it should be initialized to NULL when declared on line 21 of 
Objects/stringlib/join.h.

--
nosy: +skip.montanaro
status: closed -> open
Added file: https://bugs.python.org/file48873/join.diff

___
Python tracker 

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



[issue39153] Clarify refcounting semantics of PyDict_SetItem[String]

2020-01-30 Thread Dong-hee Na


Dong-hee Na  added the comment:

@nanjekyejoannah 
Thanks for the update :)

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



[issue39503] [security] Denial of service in urllib.request.AbstractBasicAuthHandler

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

I added this vulnerability to the following page to track fixes in all Python 
supported branches:
https://python-security.readthedocs.io/vuln/urllib-basic-auth-regex.html

--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread Michael Felt


Change by Michael Felt :


--
pull_requests: +17660
pull_request: https://github.com/python/cpython/pull/18285

___
Python tracker 

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



[issue39503] [security] Denial of service in urllib.request.AbstractBasicAuthHandler

2020-01-30 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue39503] [security] Denial of service in urllib.request.AbstractBasicAuthHandler

2020-01-30 Thread STINNER Victor


New submission from STINNER Victor :

Copy of an email received on the Python Security Response team, 9 days ago. I 
consider that it's not worth it to have an embargo on this vulnerability, so I 
make it public.

Hi there,

I believe I've found a denial-of-service (DoS) bug in
urllib.request.AbstractBasicAuthHandler. To start, I'm operating on some
background information from this document: HTTP authentication
. The bug
itself is a ReDoS  bug
causing catastrophic backtracking. To reproduce the issue we can use the
following code:

from urllib.request import AbstractBasicAuthHandler
auth_handler = AbstractBasicAuthHandler()
auth_handler.http_error_auth_reqed(
'www-authenticate',
'unused',
'unused',
{
'www-authenticate': 'Basic ' + ',' * 64 + ' ' + 'foo' + ' ' +
'realm'
}
)

The issue itself is in the following regular expression:

rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+'
'realm=(["\']?)([^"\']*)\\2', re.I)

In particular, the (?:.*,)* portion. Since "." and "," overlap and there
are nested quantifiers we can cause catastrophic backtracking by repeating
a comma. Note that since AbstractBasicAuthHandler is vulnerable, then both
HTTPBasicAuthHandler and ProxyBasicAuthHandler are as well because they
call http_error_auth_reqed. Building from the HTTP authentication document
above, this means a server can send a specially crafted header along with
an HTTP 401 or HTTP 407 and cause a DoS on the client.

I won't speculate on the severity of the issue too much - you will surely
understand the impact better than I will. Although, the fact that this is
client-side as opposed to server-side appears to reduce the severity,
however the fact that it's a security-sensitive context (HTTP
authentication) may raise the severity.

One possible fix would be changing the rx expression to the following:

rx = re.compile('(?:[^,]*,)*[ \t]*([^ \t]+)[ \t]+'
'realm=(["\']?)([^"\']*)\\2', re.I)

This removes the character overlap in the nested quantifier and thus
negates the catastrophic backtracking.

Let me know if you have any questions or what the next steps are from here.
Thanks for supporting Python security!

-- 
Matt Schwager

--
components: Library (Lib)
messages: 361072
nosy: vstinner
priority: normal
severity: normal
status: open
title: [security] Denial of service in urllib.request.AbstractBasicAuthHandler
type: security
versions: Python 2.7, Python 3.5, 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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

> Seems to be working on 64-bit, starting 32-bit test (with overflow expected). 
> Once finished will post a PR.

test_time already has tests for timestamps after year 2038, no?

--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread Michael Felt


Michael Felt  added the comment:

Seems to be working on 64-bit, starting 32-bit test (with overflow expected). 
Once finished will post a PR.

root@x065:[/data/prj/python/python3-3.9]./python
Python 3.9.0a3+ (heads/bpo-39502-dirty:8d49f7ceb4, Jan 30 2020, 14:47:52) [C] 
on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.localtime(4325562452)
time.struct_time(tm_year=2107, tm_mon=1, tm_mday=27, tm_hour=9, tm_min=7, 
tm_sec=32, tm_wday=3, tm_yday=27, tm_isdst=0)
>>> time.gmtime(4325562452)
time.struct_time(tm_year=2107, tm_mon=1, tm_mday=27, tm_hour=9, tm_min=7, 
tm_sec=32, tm_wday=3, tm_yday=27, tm_isdst=0)
>>>

--
components: +Interpreter Core
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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread miss-islington


miss-islington  added the comment:


New changeset b841633cc2d7619cf4a7db108d91b14926450a6e by Miss Islington (bot) 
in branch '3.8':
bpo-39502: Skip test_zipfile.test_add_file_after_2107() on AIX (GH-18282)
https://github.com/python/cpython/commit/b841633cc2d7619cf4a7db108d91b14926450a6e


--
nosy: +miss-islington

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-39502: Skip test_zipfile.test_add_file_after_2107() on AIX (GH-18282)

Even if localtime() is updated to support larger timestamp, this change is 
still needed for 32-bit AIX.

--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread EGuesnet


EGuesnet  added the comment:

> I'm not sure of the meaning of your patch. Are you saying that localtime() 
> supports timestamp after the year 2038 on 64-bit AIX? Did you test that 
> time.localtime(2**32) actually works as expected?

I think it worked as expected before 3.8 on 64 bit.

On AIX 64bit, with Python3.7.4,

$ python3_64
Python 3.7.4 (default, Jan 15 2020, 15:46:22)
[GCC 8.3.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import time; time.localtime(2**32)
time.struct_time(tm_year=2106, tm_mon=2, tm_mday=7, tm_hour=7, tm_min=28, 
tm_sec=16, tm_wday=6, tm_yday=38, tm_isdst=0)

and on 32bit

$ python3_32 
Python 3.7.4 (default, Jan 15 2020, 15:50:53) 
[GCC 8.3.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import time; time.localtime(2**32)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: timestamp out of range for platform time_t

With the new Python 3.8.1, on both 32 and 64bits,

Python 3.8.1 (default, Jan 30 2020, 11:23:14) 
[GCC 8.3.0] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time; time.localtime(2**32)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: localtime argument out of range

--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c232c9110cfefa0935cbf158e35e91746a8a9361 by Victor Stinner in 
branch 'master':
bpo-39502: Skip test_zipfile.test_add_file_after_2107() on AIX (GH-18282)
https://github.com/python/cpython/commit/c232c9110cfefa0935cbf158e35e91746a8a9361


--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17658
pull_request: https://github.com/python/cpython/pull/18283

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread Michael Felt


Michael Felt  added the comment:

>From memory I recall the 64-bit version worked with values above the threshold 
>value that broke the 32-bit library.

And the additional test was needed because the AIX library (iirc did not return 
NULL on error) - so had to test range before the call to get an overflow.

Working up a test of 32 and 64-bit enviornments.

--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

> Probably this broke the 64-bit usage.

I'm not sure of the meaning of your patch. Are you saying that localtime() 
supports timestamp after the year 2038 on 64-bit AIX? Did you test that 
time.localtime(2**32) actually works as expected?

In my timezone, Linux, I get:

$ python3
Python 3.7.6 (default, Dec 19 2019, 22:52:49) 
>>> import time; time.localtime(2**32)
time.struct_time(tm_year=2106, tm_mon=2, tm_mday=7, tm_hour=7, tm_min=28, 
tm_sec=16, tm_wday=6, tm_yday=38, tm_isdst=0)

--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread Michael Felt


Michael Felt  added the comment:

Probably this broke the 64-bit usage.

diff --git a/Python/pytime.c b/Python/pytime.c
index 54ddfc952b..6f13e62490 100644
--- a/Python/pytime.c
+++ b/Python/pytime.c
@@ -1059,7 +1059,7 @@ _PyTime_localtime(time_t t, struct tm *tm)
 return 0;
 #else /* !MS_WINDOWS */

-#ifdef _AIX
+#ifdef defined(_AIX) and (SIZEOF_LONG ==4)
 /* bpo-34373: AIX does not return NULL if t is too small or too large */
 if (t < -2145916800 /* 1902-01-01 */
|| t > 2145916800 /* 2038-01-01 */) {


Testing...

--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

> Tested on Python 3.8.1 on both 32 and 64 bits. Test is now skipped.

Good. I created PR 18282 from my patch.

--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread EGuesnet


EGuesnet  added the comment:

Tested on Python 3.8.1 on both 32 and 64 bits.
Test is now skipped.


test_add_file_after_2107 (test.test_zipfile.StoredTestsWithSourceFile) ... 
skipped 'time.localtime(4386268800) raises OverflowError'

--

___
Python tracker 

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



[issue39434] Remove unnecessary logic of float __floordiv__

2020-01-30 Thread Mark Dickinson


Mark Dickinson  added the comment:

Victor: I suspect there's some compiler magic going on, too; a good compiler 
should be able to figure out that half of the div/mod calculation is not being 
used, and strip it out. That wouldn't have been possible before with the tuple 
packing and unpacking.

--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

I suggest to skip the test if time.localtime() fails with OverflowError.

Can you please try attached patch on AIX, on the master branch if possible? (Or 
on Python 3.8 at least.)

--
keywords: +patch
nosy: +vstinner
Added file: https://bugs.python.org/file48872/test_zipfile.patch

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread Michael Felt


Change by Michael Felt :


--
nosy: +Michael.Felt

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-01-30 Thread EGuesnet


New submission from EGuesnet :

Hi,
I have an error during regression tests with Python3.8.1 on AIX 6.1 compiled 
with GCC 8.3.
It occurs only on 64 bit. Test passes on 32 bit.

```
==
ERROR: test_add_file_after_2107 (test.test_zipfile.StoredTestsWithSourceFile)
--
Traceback (most recent call last):
  File 
"/opt/freeware/src/packages/BUILD/Python-3.8.1/64bit/Lib/test/test_zipfile.py", 
line 606, in test_add_file_after_2107
self.assertRaises(struct.error, zipfp.write, TESTFN)
  File 
"/opt/freeware/src/packages/BUILD/Python-3.8.1/64bit/Lib/unittest/case.py", 
line 816, in assertRaises
return context.handle('assertRaises', args, kwargs)
  File 
"/opt/freeware/src/packages/BUILD/Python-3.8.1/64bit/Lib/unittest/case.py", 
line 202, in handle
callable_obj(*args, **kwargs)
  File "/opt/freeware/src/packages/BUILD/Python-3.8.1/64bit/Lib/zipfile.py", 
line 1739, in write
zinfo = ZipInfo.from_file(filename, arcname,
  File "/opt/freeware/src/packages/BUILD/Python-3.8.1/64bit/Lib/zipfile.py", 
line 523, in from_file
mtime = time.localtime(st.st_mtime)
OverflowError: localtime argument out of range
```

The PR associated to the new behavior is: 
https://github.com/python/cpython/pull/12726 (new on Python 3.8). Code is AIX 
specific. Is the code 32 bit only, or maybe the test was not updated?

-

I can reproduce the behavior as follow:

```
$ python3.8_32
Python 3.8.1 (default, Jan 27 2020, 11:34:59) 
[GCC 8.3.0] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.localtime(4325562452)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: timestamp out of range for platform time_t

$ python3.8_64
Python 3.8.1 (default, Jan 27 2020, 11:30:15) 
[GCC 8.3.0] on aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.localtime(4325562452)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: localtime argument out of range

$ python3.7_32
Python 3.7.4 (default, Jan 15 2020, 15:50:53) 
[GCC 8.3.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.localtime(4325562452)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: timestamp out of range for platform time_t

$ python3.7_64
Python 3.7.4 (default, Jan 15 2020, 15:46:22) 
[GCC 8.3.0] on aix6
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.localtime(4325562452)
time.struct_time(tm_year=2107, tm_mon=1, tm_mday=27, tm_hour=10, tm_min=7, 
tm_sec=32, tm_wday=3, tm_yday=27, tm_isdst=0)
```

--
components: Tests
messages: 361058
nosy: EGuesnet
priority: normal
severity: normal
status: open
title: test_zipfile fails on AIX due to time.localtime
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



[issue39434] Remove unnecessary logic of float __floordiv__

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks, that's a nice optimization!

I'm surprised that creating a tuple of 2 items, get one item  directly into the 
C structure, and destroy the tuple is so slow (360 ns => 185 ns: 175 ns less). 
With my FASTCALL optimization on function calls, I recall that avoiding the 
creation a tuple of N items made function calls around 20 ns faster. Not 175 ns.

--

___
Python tracker 

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



[issue39434] Remove unnecessary logic of float __floordiv__

2020-01-30 Thread Mark Dickinson


Mark Dickinson  added the comment:


New changeset 8d49f7ceb4f961770ae61fe6a4033c4e61cc3288 by Dong-hee Na in branch 
'master':
bpo-39434: Improve float __floordiv__ performance and error message (GH-18147)
https://github.com/python/cpython/commit/8d49f7ceb4f961770ae61fe6a4033c4e61cc3288


--

___
Python tracker 

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



[issue39434] Remove unnecessary logic of float __floordiv__

2020-01-30 Thread Mark Dickinson


Mark Dickinson  added the comment:

Thank you!

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



[issue39501] gettext's default localedir does not match documentation

2020-01-30 Thread Thomas Perret


New submission from Thomas Perret :

gettext's documentation (Doc/library/gettext.rst:724) states that default 
locale directory is: "sys.prefix/share/locale" but the code in gettext module 
(Lib/gettext.py:63) uses "sys.base_prefix/share/locale"

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 361054
nosy: docs@python, moht
priority: normal
severity: normal
status: open
title: gettext's default localedir does not match documentation
type: behavior

___
Python tracker 

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



[issue38063] Modify test_socket.py to use unittest test discovery

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

My PR 15751 didn't work. If someone else wants to give a try to fix this issue, 
please go ahead!

--

___
Python tracker 

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



[issue38350] ./configure --with-pydebug should use -O0 rather than -Og

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

There consensus seems to be towards the status quo: -Og is a good trade off 
between debug and performance for most core developers usage.

For the Fedora package, it may make sense to use -O0, but that should be 
discussed in Fedora ;-)

So I close the issue. Thanks for the interesting discussion :-)

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



[issue39489] Remove COUNT_ALLOCS special build

2020-01-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It was many years ago, and I used it to get some statistics about using Python 
objects of some types. But it did not work as I wanted for cached integers etc. 
In any case I can patch Python again if I need such information.

Seems Fedora was the main user of this feature. If it is no longer used in 
Fedora, I think it can be safely removed.

--

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 2a4903fcce54c25807d362dbbbcfb32d0b494f9f by Victor Stinner in 
branch 'master':
bpo-38631: Add _Py_NO_RETURN to functions calling Py_FatalError() (GH-18278)
https://github.com/python/cpython/commit/2a4903fcce54c25807d362dbbbcfb32d0b494f9f


--

___
Python tracker 

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



[issue39500] Document PyUnicode_IsIdentifier() function

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

> They are bad examples, but can't be changed for backward compatibility.

I don't think that we should follow these bad examples :-) IMO ignoring 
silently bugs is a bad programming practice.

I don't expect PyUnicode_IsIdentifier() to be used outside Python. If it's 
used, I don't see why it would be a "non-ready string" in practice. The risk of 
regression is very close to zero. If it happens, it's no longer our fault, 
since I documented the behavior change ;-) Again, right now, Python does crash 
if this corner case occurs...

--

___
Python tracker 

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



[issue39500] Document PyUnicode_IsIdentifier() function

2020-01-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Other examples are:

* PyObject_HasAttr
* PyObject_HasAttrString
* PyMapping_HasKey
* PyMapping_HasKeyString

They are bad examples, but can't be changed for backward compatibility. I 
wonder whether PyUnicode_IsIdentifier should also kept unchanged for backward 
compatibility.

There is also a number of *_Check functions which always succeeds.

Other example is _PyUnicode_EqualToASCIIString where the behavior is 
intentional.

PyUnicode_IsIdentifier() was not documented before. It makes easier to change 
its behavior.

--

___
Python tracker 

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



[issue39424] [easy] test_signal: test_pidfd_send_signal() uses deprecated assertRaisesRegexp() method

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks damani42 for the fix!


Hakan: "I want to work on this as my first contribution"

I'm sorry for you, damani42 was faster than you to propose a PR! You can look 
for other "newcomer friendly" issues on the bug tracker by searching per 
keyword.

--

___
Python tracker 

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



[issue39489] Remove COUNT_ALLOCS special build

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

I started a thread on the python-dev mailing list:
https://mail.python.org/archives/list/python-...@python.org/thread/YEY2TZIWC6HGMM5Y3QKWKMEBT5Y5C324/

Serhiy:
> I used COUNT_ALLOCS for curiosity. But I needed slightly different 
> information, so in any case I patched the code.

Did you use it recently? I understand that the unmodified feature didn't help 
for your use case. Was it to debug memory leaks?


Serhiy:
> AFAIK COUNT_ALLOCS is used in some large projects (maybe Fedora). It was 
> already discussed somewhere on the tracker, but I have no a link.

Did you read previous comments, especially msg360985? It's no longer used in 
Fedora :-) Technically, it's still used in the python2 package, but it's gone 
from python3 package. But this issue is about Python 3.9, not Python 2 ;-)

FYI I'm now working in the Python Maintenance team at Red Hat which maintains 
python2 and python3 packages of Fedora.

By the way, Charalampos Stratakis is also in my team and he replied on 
python-dev:

"I've never used this feature and it was quite the hassle to maintain those 
patches downstream, so in my biased opinion, I would welcome the removal."

https://mail.python.org/archives/list/python-...@python.org/message/4BI64IXNZMJGXNHOA34UJ35V74IGJNZF/

--

___
Python tracker 

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



[issue39465] Design a subinterpreter friendly alternative to _Py_IDENTIFIER

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

> AFAIK there is no problem now, except possibly a race condition when 
> initializing the identifiers.

The GIL avoids any risk of race condition, no?

--

___
Python tracker 

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



[issue39500] Document PyUnicode_IsIdentifier() function

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

> Since the behavior was changed, I think we need a versionchanged directive.

Done.


> But I am not sure that it could be triggered in real code without using some 
> broken extensions.

_PyUnicode_Ready() can fail in two cases: the Py_UNICODE* string contains a 
character outside [U+; U+10] character range, or a memory allocation 
failed. Both cases look very unlikely, knowning that _PyUnicode_Ready() is only 
called if PyUnicode_IsIdentifier() is called on a string using the Python 
legacy C API (Py_UNICODE*).


> It may be safer to return 0 instead of returning -1 or crashing if 
> PyUnicode_READY() fails.

Functions which don't use PyObject* as return type have the tradition of 
returning -1. A few examples:

* PyUnicode_GetLength()
* PyUnicode_CopyCharacters()
* PyUnicode_ReadChar() (return "(Py_UCS4)-1" on error)
* PyLong_AsUnsignedLong() (return "(unsigned long)-1" on error)
* etc.

I don't see why PyUnicode_IsIdentifier() deserves to behave differently.


> If return -1 and set an exception, it can lead to an unexpected behavior if 
> the calling code expects only 0/1, and maybe even to crash in debug build due 
> to set an exception and returning value.

I updated my PR to document the behavior change in the "Changes in the C API" 
section of What's New in Python 3.9 documentation.

Previously, the code crashed Python (Py_FatalError). So I'm confident that this 
case never occurred ever in the wild. We got zero bug report about that.

--

___
Python tracker 

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



[issue39465] Design a subinterpreter friendly alternative to _Py_IDENTIFIER

2020-01-30 Thread Petr Viktorin


Petr Viktorin  added the comment:

> What is the problem between _Py_IDENTIFIER and multi-phase initialisation 
> modules?

AFAIK there is no problem now, except possibly a race condition when 
initializing the identifiers.
It seems it's too easy to conflate porting to multi-phase initialization and 
getting rid of static state.


The problem will come with per-interpreter reference counting, or when the 
`str` class is no longer shared across all interpreters. For that, we'll need 
either per-interpreter identifiers, or solve the issue in another way.

--

___
Python tracker 

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



[issue39465] Design a subinterpreter friendly alternative to _Py_IDENTIFIER

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

> Both https://github.com/python/cpython/pull/18066 (collections module) and 
> https://github.com/python/cpython/pull/18032 (asyncio module) ran into the 
> problem where porting them to multi-phase initialisation involves replacing 
> their usage of the `_Py_IDENTIFIER` macro with some other mechanism.

What is the problem between _Py_IDENTIFIER and multi-phase initialisation 
modules?

If both are incompatible, we may need a different but similar API: values would 
be stored in a hash table per module object. The hash table can be stored in 
the module object directly, or it can be store in a second hash table (module 
=> hash table).

If we want a unified API, maybe we can use module=NULL (or any other marker) 
for "global" identifiers (not specific to a module).

--

___
Python tracker 

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



[issue39465] Design a subinterpreter friendly alternative to _Py_IDENTIFIER

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

Once I discussed with Eric Snow during a core developer sprint: 
_Py_IDENTIFIER() should use an "interpreter local storage" for identifiers 
values. _Py_IDENTIFIER() would only be a "key" and _PyUnicode_FromId() would 
store the value somewhere in a hash table stored in PyInterpreterState. 
Something similar to the TSS API:

* PyThread_create_key()
* PyThread_delete_key_value()
* PyThread_set_key_value()
* PyThread_get_key_value()

But per interpreter, rather than being per thread.

The key can be simply the variable address in memory. It only has to be unique 
in the process.

--
nosy: +vstinner

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 17c68b8107e348aeaaa05f7ac5072cacff916022 by Victor Stinner in 
branch 'master':
bpo-38631: Replace Py_FatalError() with assert() in ceval.c (GH-18279)
https://github.com/python/cpython/commit/17c68b8107e348aeaaa05f7ac5072cacff916022


--

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ec3c99c8a73650d7833189bd973ec492564aa479 by Victor Stinner in 
branch 'master':
bpo-38631: Avoid Py_FatalError() in unicodeobject.c (GH-18281)
https://github.com/python/cpython/commit/ec3c99c8a73650d7833189bd973ec492564aa479


--

___
Python tracker 

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



[issue39401] [CVE-2020-8315] Unsafe dll loading in getpathp.c on Win7

2020-01-30 Thread Anthony Wee


Anthony Wee  added the comment:

> Thanks Anthony for the report! I included your name as the reporter, though I 
> don't see it on any of the pages.

No problem! Thanks Steve, Eryk, and Victor for jumping on this!

--

___
Python tracker 

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



[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

2020-01-30 Thread Mark Dickinson


Mark Dickinson  added the comment:

I'd guess a // gcd(a, b) * b would be faster, on the basis that division is 
slower than multiplication. But I doubt it's worth worrying about for this 
implementation, given that the gcd call is likely to be the bottleneck as a and 
b get large.

--

___
Python tracker 

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



[issue39489] Remove COUNT_ALLOCS special build

2020-01-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I used COUNT_ALLOCS for curiosity. But I needed slightly different information, 
so in any case I patched the code.

AFAIK COUNT_ALLOCS is used in some large projects (maybe Fedora). It was 
already discussed somewhere on the tracker, but I have no a link.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

2020-01-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

If a < b, what is better,

a // gcd(a, b) * b

or

b // gcd(a, b) * a

? Or there is no difference?

--

___
Python tracker 

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



[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2020-01-30 Thread Philipp Rehs


Philipp Rehs  added the comment:

Are there any reasons why it does not get merged?
This issue is open since more than two years and the fix is quiet small

--
nosy: +Philipp Rehs
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



[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

2020-01-30 Thread Mark Dickinson


Mark Dickinson  added the comment:

Great. For clarity, here's a Python function giving the behaviour I'd expect 
from a 2-arg lcm:

from math import gcd

def lcm(a, b):
if a == 0:
return 0
return abs(a // gcd(a, b) * b)

--

___
Python tracker 

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



[issue39424] [easy] test_signal: test_pidfd_send_signal() uses deprecated assertRaisesRegexp() method

2020-01-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue39424] [easy] test_signal: test_pidfd_send_signal() uses deprecated assertRaisesRegexp() method

2020-01-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 38c878b56cff997de8fb04a586c963039b69b414 by damani42 in branch 
'master':
bpo-39424: Use assertRaisesRegex instead of assertRaisesRegexp. (GH-18277)
https://github.com/python/cpython/commit/38c878b56cff997de8fb04a586c963039b69b414


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue39500] Document PyUnicode_IsIdentifier() function

2020-01-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Since the behavior was changed, I think we need a versionchanged directive.

This function was added in 3.0. Prior to 3.3 it was always successful (if you 
pass an unicode object, that is required for most of PyUnicode API). 
Py_FatalError was added in 3.3, because not all unicode object are now valid. 
But I am not sure that it could be triggered in real code without using some 
broken extensions.

It may be safer to return 0 instead of returning -1 or crashing if 
PyUnicode_READY() fails. If return -1 and set an exception, it can lead to an 
unexpected behavior if the calling code expects only 0/1, and maybe even to 
crash in debug build due to set an exception and returning value.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue39487] Merge duplicated _Py_IDENTIFIER identifiers in C code

2020-01-30 Thread hai shi


hai shi  added the comment:

If i understand clearly, msg360993 is an solution of issue39465.

--

___
Python tracker 

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



[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

2020-01-30 Thread Ananthakrishnan A S


Ananthakrishnan A S  added the comment:

Yes,I want to put together a PR.

--

___
Python tracker 

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



[issue39497] Unused variable script_str in pysqlite_cursor_executescript

2020-01-30 Thread Berker Peksag


Change by Berker Peksag :


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

___
Python tracker 

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



[issue39497] Unused variable script_str in pysqlite_cursor_executescript

2020-01-30 Thread Berker Peksag


Berker Peksag  added the comment:


New changeset 1f44e775df8e7ec3ca60a1135cb3279f8b9dca3e by Alex Henrie in branch 
'master':
bpo-39497: Remove unused variable from pysqlite_cursor_executescript (GH-18271)
https://github.com/python/cpython/commit/1f44e775df8e7ec3ca60a1135cb3279f8b9dca3e


--
nosy: +berker.peksag

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-30 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17656
pull_request: https://github.com/python/cpython/pull/18281

___
Python tracker 

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



[issue39500] Document PyUnicode_IsIdentifier() function

2020-01-30 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue39500] Document PyUnicode_IsIdentifier() function

2020-01-30 Thread STINNER Victor


New submission from STINNER Victor :

The PyUnicode_IsIdentifier() function should be documented.

Attachd PR documents it.

--
components: C API, Unicode
messages: 361027
nosy: ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: Document PyUnicode_IsIdentifier() function
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



[issue39458] Multiprocessing.Pool maxtasksperchild=1 doesn't work

2020-01-30 Thread Gabriel Tardif


Gabriel Tardif  added the comment:

Be aware that maxtasksperchild work together with the chunksize parameter of 
the map fonction when you use it and the default chunksize value is not 1, it's 
calculated according to your inputs, process and other parameters.

--
resolution:  -> not a bug

___
Python tracker 

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



[issue39458] Multiprocessing.Pool maxtasksperchild=1 doesn't work

2020-01-30 Thread Gabriel Tardif


Change by Gabriel Tardif :


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



[issue39499] ValueError using index on tuple is not showing the tuple value

2020-01-30 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This is a duplicate of issue33560. See also issue13349 which is the original 
duplicate.

--
nosy: +xtreak
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Non-informative error message in index() and remove() functions
type:  -> behavior

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-30 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17654
pull_request: https://github.com/python/cpython/pull/18279

___
Python tracker 

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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

binascii.crc_hqx() is no longer deprecated. I close again the issue.

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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c38fd0df2b4cbc1cc906d8dfe23f63b67cd6965f by Victor Stinner in 
branch 'master':
bpo-39353: binascii.crc_hqx() is no longer deprecated (GH-18276)
https://github.com/python/cpython/commit/c38fd0df2b4cbc1cc906d8dfe23f63b67cd6965f


--

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-30 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17653
pull_request: https://github.com/python/cpython/pull/18278

___
Python tracker 

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



[issue39424] [easy] test_signal: test_pidfd_send_signal() uses deprecated assertRaisesRegexp() method

2020-01-30 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue39401] [CVE-2020-8315] Unsafe dll loading in getpathp.c on Win7

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:

>> I added 
>> https://python-security.readthedocs.io/vuln/unsafe-dll-load-windows-7.html 
>> to track fixes in all branches.

> Thanks, Victor! Python 2.7 and 3.5 are not vulnerable. The issue was added in 
> 3.6 when I added support for installing Python into a long path name on 
> up-to-date OS, which required dynamically loading an OS function. That 
> dynamic load was the problem.

Oh ok, I updated the page to reflect that. I also added 3.7 & 3.8 commits.

--

___
Python tracker 

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



[issue39479] [RFE] Add math.lcm() function: Least Common Multiple

2020-01-30 Thread Mark Dickinson


Mark Dickinson  added the comment:

+0 from me as well; agreed with everything that Tim said (except that I've 
never had a need for the Carmichael function; my RSA implementations do the 
inefficient thing based on (p-1)(q-1)).

This is somewhat reminiscent of comb and perm: lcm is often taught as a natural 
counterpart to gcd, so despite the fact that it's less fundamental and has less 
utility, people often expect to see the two together.

@Ananthakrishnan: do you want to put together a PR? I'll commit to reviewing it 
if you do.

--

___
Python tracker 

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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-30 Thread STINNER Victor

STINNER Victor  added the comment:

> Of course I would prefer “crc_hqx” to stay, because we use it at work.

I propose to deprecate it because I understood that it was strictly related to 
binhex4 and hexbin4 protocols. If there is an use case outside these protocols, 
I'm fine with maintaining it.

The first motivation was to drop the binhex module in the long term, I'm less 
worried about specific binascii functions.

--

___
Python tracker 

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



[issue39353] Deprecate the binhex module, binhex4 and hexbin4 standards

2020-01-30 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 2bf127d97bd1d60ead7c20d429b0c61ef61fc554 by Victor Stinner in 
branch 'master':
bpo-38631: Replace tp_new_wrapper() fatal error with SystemError (GH-18262)
https://github.com/python/cpython/commit/2bf127d97bd1d60ead7c20d429b0c61ef61fc554


--

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 7a1f6c2da46a04d0ff0acc01542f30bfeaf0e0c7 by Victor Stinner in 
branch 'master':
bpo-38631: Avoid Py_FatalError() in init_slotdefs() (GH-18263)
https://github.com/python/cpython/commit/7a1f6c2da46a04d0ff0acc01542f30bfeaf0e0c7


--

___
Python tracker 

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



[issue38631] Replace Py_FatalError() with regular Python exceptions

2020-01-30 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5eb8bff7e4aa7e4d8580a30323641388c8ff59a5 by Victor Stinner in 
branch 'master':
bpo-38631: Replace Py_FatalError() with _PyObject_ASSERT_FAILED_MSG() (GH-18258)
https://github.com/python/cpython/commit/5eb8bff7e4aa7e4d8580a30323641388c8ff59a5


--

___
Python tracker 

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