[issue39300] dataclasses non-default argument follows default argument

2020-01-10 Thread lijok


lijok  added the comment:

> I think this is a combination of the above statement at end of [0] and 
> inheritance following the order of the fields at [1]

Ah, I see, so if I understand correctly the init method for the example given 
would become __init__(self, PARAM: int = 1, ARG: int) since the fields are kept 
in an ordered mapping

Thank you

--

___
Python tracker 

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



[issue39301] Specification of bitshift on integers should clearly state floor division used

2020-01-10 Thread Nick Coghlan


New submission from Nick Coghlan :

While reviewing ISO-IECJTC1-SC22-WG23's latest draft of their Python security 
annex, I noticed that 
https://docs.python.org/3.7/library/stdtypes.html#bitwise-operations-on-integer-types
 doesn't explicitly state that *floor* division is used for right shift 
operations, so right-shifting a negative number by more bits than it contains 
gives -1 rather than 0.

This is consistent with the way the language spec defines both binary 
right-shifts (as division by "pow(2, n)" and floor division (as rounding 
towards negative infinity), so this is just a documentation issue to note that 
we should make it clearer that this behaviour is intentional.

--
assignee: docs@python
components: Documentation
messages: 359786
nosy: docs@python, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Specification of bitshift on integers should clearly state floor 
division used
type: enhancement
versions: Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue17718] boolop constant checking for if/while

2020-01-10 Thread Benjamin Peterson


Change by Benjamin Peterson :


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



[issue17718] boolop constant checking for if/while

2020-01-10 Thread Zackery Spytz


Zackery Spytz  added the comment:

I think this issue should be closed.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue38704] Prevent installation on unsupported Windows versions

2020-01-10 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue39300] dataclasses non-default argument follows default argument

2020-01-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

See also issue36077

--

___
Python tracker 

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



[issue38704] Prevent installation on unsupported Windows versions

2020-01-10 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue39300] dataclasses non-default argument follows default argument

2020-01-10 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

> TypeError will be raised if a field without a default value follows a field 
> with a default value. This is true either when this occurs in a single class, 
> or as a result of class inheritance.

I think this is a combination of the above statement at end of [0] and 
inheritance following the order of the fields at [1]

[0] https://docs.python.org/3/library/dataclasses.html#dataclasses.dataclass
[1] https://docs.python.org/3/library/dataclasses.html#inheritance

--
nosy: +xtreak

___
Python tracker 

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



[issue39300] dataclasses non-default argument follows default argument

2020-01-10 Thread lijok


New submission from lijok :

from dataclasses import dataclass


@dataclass
class A:
PARAM: int


@dataclass
class B(A):
ARG: int
PARAM: int = 1

Traceback (most recent call last):
  File "", line 2, in 
  File 
"C:\Users\user\AppData\Local\Programs\Python\Python38\lib\dataclasses.py", line 
1021, in dataclass
return wrap(cls)
  File 
"C:\Users\user\AppData\Local\Programs\Python\Python38\lib\dataclasses.py", line 
1013, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
  File 
"C:\Users\user\AppData\Local\Programs\Python\Python38\lib\dataclasses.py", line 
927, in _process_class
_init_fn(flds,
  File 
"C:\Users\user\AppData\Local\Programs\Python\Python38\lib\dataclasses.py", line 
503, in _init_fn
raise TypeError(f'non-default argument {f.name!r} '
TypeError: non-default argument 'ARG' follows default argument

--
components: Library (Lib)
messages: 359782
nosy: eric.smith, lijok
priority: normal
severity: normal
status: open
title: dataclasses non-default argument follows default argument
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



[issue39298] add BLAKE3 to hashlib

2020-01-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue39298] add BLAKE3 to hashlib

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



[issue39299] Improve test coverage for mimetypes module

2020-01-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue39299] Improve test coverage for mimetypes module

2020-01-10 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

Currently the test coverage for mimetypes module is at 57% 
https://codecov.io/gh/python/cpython/src/43682f1e39a3c61f0e8a638b887bcdcbfef766c5/Lib/mimetypes.py
 . I propose adding the following tests to increase the coverage.

* Add test for case insensitive check of types and extensions.
* Add test for data url with no comma.
* Add test for read_mime_types function.
* Add tests for the mimetypes cli.

--
components: Tests
messages: 359781
nosy: xtreak
priority: normal
severity: normal
status: open
title: Improve test coverage for mimetypes module
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue39288] Add math.nextafter(a, b)

2020-01-10 Thread Tim Peters


Tim Peters  added the comment:

[Steven]
> I think the second argument should also be optional, so
> that nextafter(x) returns the next representable float.

That's why the name sucks - there are, in general, two adjacent floats, so 
"next" is ambiguous.  I expect you intend that y default to math.inf, which 
would make one-argument `nextafter(x)` a spelling of `nextUp(x)`.  Fine by me!  
That's probably the one I want most often.

--

___
Python tracker 

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



[issue39288] Add math.nextafter(a, b)

2020-01-10 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I agree, "nextafter" is so widely used it's probably pointless to fight against 
the name :-)

Mark: "IEEE 754, on the other hand, requires instead nextUp and nextDown".

I know Wikipedia isn't a primary source, but it says IEEE 754 recommends 
nextafter(x, y).

My understanding of IEEE-754 is that the functionality is required, not the 
specific API. That is, it's not required to have literally two functions called 
"nextUp" and "nextDown", so long as you can get the next larger and next 
smaller float.

I think the second argument should also be optional, so that nextafter(x) 
returns the next representable float.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue39207] concurrent.futures.ProcessPoolExecutor does not properly reap jobs and spawns too many workers

2020-01-10 Thread Kyle Stanley


Kyle Stanley  added the comment:

> What "ignores the max_workers argument" means?

>From my understanding, their argument was that the parameter name 
>"max_workers" and documentation implies that it will spawn processes as needed 
>up to *max_workers* based on the number of jobs scheduled. 

> And would you create a simple reproducible example?

I can't speak directly for the OP, but this simple example may demonstrate what 
they're talking about:

Linux 5.4.8
Python 3.8.1

```
import concurrent.futures as cf
import os
import random

def get_rand_nums(ls, n):
return [random.randint(1, 100) for i in range(n)]

def show_processes():
print("All python processes:")
os.system("ps -C python")

def main():
nums = []
with cf.ProcessPoolExecutor(max_workers=6) as executor:
futs = []
show_processes()
for _ in range(3):
fut = executor.submit(get_rand_nums, nums, 10_000_000)
futs.append(fut)
show_processes()
for fut in cf.as_completed(futs):
nums.extend(fut.result())
show_processes()

assert len(nums) == 30_000_000

if __name__ == '__main__':
main()
```

Output:

```
[aeros:~/programming/python]$ python ppe_max_workers.py
All python processes: # Main python process
PID TTY  TIME CMD
  23683 pts/100:00:00 python
All python processes: # Main python process + 6 unused subprocesses
PID TTY  TIME CMD
  23683 pts/100:00:00 python
  23685 pts/100:00:00 python
  23686 pts/100:00:00 python
  23687 pts/100:00:00 python
  23688 pts/100:00:00 python
  23689 pts/100:00:00 python
  23690 pts/100:00:00 python
All python processes: # Main python process + 3 used subprocesses + 3 unused 
subprocesses
PID TTY  TIME CMD
  23683 pts/100:00:00 python
  23685 pts/100:00:07 python
  23686 pts/100:00:07 python
  23687 pts/100:00:07 python
  23688 pts/100:00:00 python
  23689 pts/100:00:00 python
  23690 pts/100:00:00 python
```

As seen above, all processes up to *max_workers* were spawned immediately after 
the jobs were submitted to ProcessPoolExecutor, regardless of the actual number 
of jobs (3). It is also apparent that only three of those spawned processes 
were utilized by the CPU, as indicated by the values in the TIME field. The 
other three processes were not used.

If it wasn't for this behavior, I think there would be a significant 
performance loss, as the executor would have to continuously calculate how many 
processes are needed and spawn them throughout it's lifespan. AFAIK, it _seems_ 
more efficient to spawn *max_workers* processes when the jobs are scheduled, 
and then use them as needed; rather than spawning the processes as needed.

As a result, I think the current behavior should remain the same; unless 
someone can come up with a backwards-compatible alternative version and 
demonstrate its advantages over the current one.

However, I do think the current documentation could do a better at explaining 
how max_workers actually behaves. See the current explanation: 
https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.ProcessPoolExecutor.

The current version does not address any of the above points. In fact, the 
first line seems like it might imply the opposite of what it's actually doing 
(at least based on my above example):

"An Executor subclass that executes calls asynchronously *using a pool of at 
most max_workers processes*." (asterisks added for emphasis)

"using a pool of at most max_workers processes" could imply to users that 
*max_workers* sets an upper bound limit on the number of processes in the pool, 
but that *max_workers* is only reached if all of those processes are _needed_. 
Unless I'm misunderstanding something, that's not the case.

I would suggest converting this into a documentation issue, assuming that the 
experts for the concurrent.futures confirm that the present behavior is 
intentional and that I'm correctly understanding the OP.

--
nosy: +aeros

___
Python tracker 

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



[issue39298] add BLAKE3 to hashlib

2020-01-10 Thread Larry Hastings


New submission from Larry Hastings :

>From 3/4 of the team that brought you BLAKE2, now comes... BLAKE3!

https://github.com/BLAKE3-team/BLAKE3

BLAKE3 is a brand new hashing function.  It's fast, it's paralellizeable, and 
unlike BLAKE2 there's only one variant.

I've experimented with it a little.  On my laptop (2018 Intel i7 64-bit), the 
portable implementation is kind of middle-of-the-pack, but with AVX2 enabled 
it's second only to the "Haswell" build of KangarooTwelve.  On a 32-bit ARMv7 
machine the results are more impressive--the portable implementation is 
neck-and-neck with MD4, and with NEON enabled it's definitely the fastest hash 
function I tested.  These tests are all single-threaded and eliminate I/O 
overhead.

The above Github repo has a reference implementation in C which includes Intel 
and ARM SIMD drivers.  Unsurprisingly, the interface looks roughly the same as 
the BLAKE2 interface(s), so if you took the existing BLAKE2 module and 
s/blake2b/blake3/ you'd be nearly done.  Not quite as close as blake2b and 
blake2s though ;-)

--
components: Library (Lib)
keywords: patch
messages: 359777
nosy: Zooko.Wilcox-O'Hearn, christian.heimes, larry
priority: normal
severity: normal
stage: needs patch
status: open
title: add BLAKE3 to hashlib
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-10 Thread Dong-hee Na


Dong-hee Na  added the comment:

CPython or stdlib: There is no code depends on the error message of range and 
min/max.
3rd party: IMHO, if somebody relies on the error message, not error type, I 
think that the code pattern is bad usage

And as I mentioned on msg359243, other python compatible compilers/interpreters 
already don't follow the same error message as CPython. 
If the issue had been caused by this issue, it would have already been 
reported. But it doesn't seem to be.

So my conclusion is that it will not be a problem. :)

--

___
Python tracker 

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



[issue39288] Add math.nextafter(a, b)

2020-01-10 Thread Tim Peters


Tim Peters  added the comment:

No doubt that something along these lines would be useful.

`nextafter()` is too widely implemented to fight against, despite the sucky 
name ;-)

I believe the rest should be straightforward (for those who want them) to do 
with one-liners, so there's not much of a case for building them in.  Or is 
that wrong?  My guesses for correct implementations:

def nextUp(x):
return math.nextafter(x, math.inf)

def nextDown(x):
return math.nextafter(x, -math.inf)

def nextAwayFromZero(x):
return math.nextafter(x, math.copysign(math.inf, x))

That last assumes you want -0 and +0 to act differently; i.e., want

nextAwayFromZero(0.0) == 5e-324
and
nextAwayFromZero(-0.0) == -5e-324

--

___
Python tracker 

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



[issue39247] dataclass defaults and property don't work together

2020-01-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

> During this processing of fields, couldn't you just special case 
> property/descriptor objects?

What if you want the field to be a descriptor?

I think the best way of handling this would be to use some sentinel value for 
the default, and if found look up the value on the instance, not the class.

But I'm a little worried this might break something else.

--

___
Python tracker 

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



[issue39275] Traceback off by one line when

2020-01-10 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions:  -Python 3.6

___
Python tracker 

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



[issue39297] Synchronize importlib.metadata with importlib_metadata 1.4

2020-01-10 Thread Jason R. Coombs


Change by Jason R. Coombs :


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

___
Python tracker 

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



[issue39274] Conversion from fractions.Fraction to bool

2020-01-10 Thread Terry J. Reedy


Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue39297] Synchronize importlib.metadata with importlib_metadata 1.4

2020-01-10 Thread Jason R. Coombs


New submission from Jason R. Coombs :

Importlib_metadata 1.4 adds performance improvements to the distribution 
discovery mechanism. Let's incorporate those upstream.

--
components: Library (Lib)
messages: 359773
nosy: jaraco
priority: normal
severity: normal
status: open
title: Synchronize importlib.metadata with importlib_metadata 1.4
versions: 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



[issue39249] difflib SequenceMatcher 200 char length limitation for ratio calculation

2020-01-10 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> difflib SequenceMatcher ratio() still have unpredictable 
behavior

___
Python tracker 

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



[issue39231] Mistaken notion in tutorial

2020-01-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

https://docs.python.org/3/tutorial/controlflow.html#function-annotations
is the direct link.

As Mark said, 'ham' is a required positional-or-keyword argument.
'eggs' is an optional 'positional-or-keyword.  The sentence as is is wrong, 
even if Robert garbled the reason.  With the signature as it, the sentence 
should be "The following example has a required argument, an optional argument, 
and the return value annotated."

To make the existing sentence true, the signature could be changed to
  def f(ham: str, /, *, eggs: str) -> str:
But I think this would be wrong.  Annotation does not depend on how an argument 
is passed, but whether it has a default (making it optional).  In particular, 
it shows that when optional, the annotation goes *before* '= default', not 
after.  (It could have gone after: eggs = 'eggs': str.)

--
nosy: +terry.reedy

___
Python tracker 

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



[issue39288] Add math.nextafter(a, b)

2020-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

> NumPy has nextafter.

That's why I proposed math.nextafter() name.

Moreover, in the math module, most functions reuse the same names than C 
function names: expm1(), atan2(), erf(), etc.


> IEEE 754, on the other hand, requires instead nextUp and nextDown, which take 
> a single argument and move towards +inf or -inf (respectively).

When I played with bpo-39277, I used nextafter() to try to implement manually a 
conversion from an integer to a float using rounding towards zero. So I prefer 
nextafter() than nextUp()/nextDown(): it gives more features.


> but nextAwayFromZero doesn't match any of these

It seems easy to reimplement it using nextafter(), no?

def nextAwayFromZero(x):
if x < 0:
return math.nextafter(x, -float("inf"))
else:
return math.nextafter(x, +float("inf"))


> Python's Decimal type has a two-argument next_toward method.

It also has next_minus() and next_plus() which don't match "nextUp and 
nextDown" names requires by IEEE 754.

I'm not comfortable with math.next_after() or math.next_toward() name: use a 
different than the libc function name (add an underscore). For me, the math 
module is a thin wrapper to libm function, as the os module is a thin wrapper 
to libc functions.

--

___
Python tracker 

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



[issue39228] traceback.FrameSummary does not handle exceptions from `repr()`

2020-01-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

As is true for most special methods, it is a bug for __repr__ methods to raise. 
 They should return a string, as documented.

Special method wrappers generally assume that the wrapped methods work.  In 
particular, repr assumes this, and so do the __repr__ methods of all 
collections classes.  They do not try to hide bugs.  Example:

>>> class BadRep:
def __repr__(self): 1/0


>>> br = BadRep()
>>> [br]
Traceback (most recent call last):
  File "", line 1, in 
[br]
  File "C:\Programs\Python39\lib\idlelib\rpc.py", line 620, in displayhook
text = repr(value)
  File "", line 2, in __repr__
def __repr__(self): 1/0
ZeroDivisionError: division by zero

Bugs should be reported, not masked.  I don't think that FrameSummary should be 
an exception to this.  Therefore I think that this issue should be closed 
(along with the PR) as 'not a bug'.

--
nosy: +terry.reedy
versions:  -Python 3.5, Python 3.6

___
Python tracker 

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



[issue39219] Fix attributes of syntax errors raized in the tokenizer

2020-01-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

On entry of '0xz', IDLE from 3.6 to date highlights the '0x' part of the 
original entry.  I presume it can do this because it ignores the text 
attribute, and because bytes == chars for at least  '0x'.

The 'proposed PR' is not listed here.  Is it not yet submitted, or is the issue 
number wrong?

--
nosy: +terry.reedy

___
Python tracker 

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



[issue39217] GC of a ctypes object causes application crash

2020-01-10 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

"Is this a bug" questions are often better asked on python-list.  (I don't 
know.)  If so, the bug needed to be tested on the current development version 
(3.9 now).  Likely, someone on python-list will try given reproducible code.


2.7 has reach EOL.

--
nosy: +terry.reedy
versions: +Python 3.9 -Python 2.7, Python 3.7

___
Python tracker 

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



[issue38330] httplib specifies content-length when transfer-encoding present

2020-01-10 Thread apmatthews


apmatthews  added the comment:

ping :)

--

___
Python tracker 

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



[issue39207] concurrent.futures.ProcessPoolExecutor does not properly reap jobs and spawns too many workers

2020-01-10 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +bquinlan, pitrou

___
Python tracker 

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



[issue17254] add thai encoding aliases to encodings.aliases

2020-01-10 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
versions: +Python 3.9 -Python 3.4

___
Python tracker 

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



[issue36516] Python Launcher can not recognize pyw file as Python GUI Script file type correctly.

2020-01-10 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue36556] Trashcan causing duplicated __del__ calls

2020-01-10 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
resolution:  -> wont fix
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



[issue38901] [venv] Add a CLI flag to venv to use the pwd basename as the prompt

2020-01-10 Thread Vinay Sajip


Change by Vinay Sajip :


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

___
Python tracker 

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



[issue32021] Brotli encoding is not recognized by mimetypes

2020-01-10 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Now that two years have passed, is there any additional info as to whether this 
should be added or not?  It does seem that the format is active 
(https://github.com/google/brotli).

--
nosy: +cheryl.sabella
versions: +Python 3.8, Python 3.9 -Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

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



[issue39296] Windows register keys

2020-01-10 Thread Tony


New submission from Tony :

It would be more practical to name the Windows main registry keys 'python', 
with for example 'python32' or 'python64'. This would make searching the 
registry for registered python versions (single and/or multi users) a lot 
easier.

--
components: Windows
messages: 359765
nosy: ToKa, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Windows register keys
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



[issue38567] urllib.parse.unquote_plus raises incorrect error message when string parameter is bytes

2020-01-10 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
nosy: +orsenthil

___
Python tracker 

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



[issue39247] dataclass defaults and property don't work together

2020-01-10 Thread Juan Arrivillaga


Juan Arrivillaga  added the comment:

Actually, couldn't the following be a workaround, just set the property on the 
class after the class definition:


import dataclasses
import typing
@dataclasses.dataclass
class FileObject:
uploaded_by:typing.Optional[None]=None

def _uploaded_by_getter(self):
return self._uploaded_by

def _uploaded_by_setter(self, uploaded_by):
print('Setter Called with Value ', uploaded_by)
self._uploaded_by = uploaded_by

FileObject.uploaded_by = property(
FileObject._uploaded_by_getter,
FileObject._uploaded_by_setter
)
p = FileObject()
print(p)
print(p.uploaded_by)

--

___
Python tracker 

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



[issue17013] Allow waiting on a mock

2020-01-10 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
versions: +Python 3.9 -Python 3.8

___
Python tracker 

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



[issue39295] usage of bitfields in ctypes structures changed between 3.7.5 and 3.7.6

2020-01-10 Thread Matthew Newville


New submission from Matthew Newville :

We have a library (https://github.com/pyepics/pyepics) that wraps several C 
structures for a communication protocol library that involves many C->Python 
callbacks.  One of the simpler structures we wrap with ctypes is defined with

typedef struct ca_access_rights {
unsignedread_access:1;
unsignedwrite_access:1; } caar;

struct  access_rights_handler_args {
long  chanId; /* channel id */
caar  access; /* access rights state */
};

which we had wrapped (perhaps naively) as 

class access_rights_handler_args(ctypes.Structure):
"access rights arguments"
_fields_ = [('chid', ctypes.c_long),
('read_access', ctypes.c_uint, 1),
('write_access', ctypes.c_uint, 1)]

which we would then this structure as the function argument of a callback 
function that the underlying library would call, using

_Callback = ctypes.CFUNCTYPE(None, 
ctypes.POINTER(access_rights_handler_args))(access_rights_handler)

and the python function `access_righte_handler` would be able to unpack and use 
this structure.  This worked for Python 2.7, 3.3 - 3.7.5 on 64-bit Linux, 
Windows, and MacOS.  This code was well-tested and was used in production code 
on very many systems. It did not cause segfaults.

With Python 3.7.6 this raises an exception at the ctypes.CFUNCTYPE() call with


./lib/python3.7/ctypes/__init__.py", line 99, in CFUNCTYPE
class CFunctionType(_CFuncPtr):
TypeError: item 1 in _argtypes_ passes a struct/union with a bitfield by value, 
which is unsupported.


We were able to find a quick work-around this by changing the structure 
definition to be

class access_rights_handler_args(ctypes.Structure):
"access rights arguments"
_fields_ = [('chid', ctypes.c_long),
('access', ctypes.c_ubyte)]

and then explicitly extract the 2 desired bits from the byte. Of course, that 
byte is more data than is being sent in the structure, so there is trailing 
garbage.

This change seems to have been related to https://bugs.python.org/issue16576.

Is there any way to restore the 
no-really-I'm-not-making-it-up-it-was-most-definitely-working-for-us behavior 
of Python 3.7.5 and earlier?  

If this is not possible, what would be the right way to wrap this sort of 
structure? Thanks

--
components: ctypes
messages: 359763
nosy: Matthew Newville
priority: normal
severity: normal
status: open
title: usage of bitfields in ctypes structures changed between 3.7.5 and 3.7.6
type: behavior
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



[issue39294] zipfile.ZipInfo objects contain invalid 'extra' fields.

2020-01-10 Thread Bram Stolk


New submission from Bram Stolk :

This has been tested with Windows Python 2.7 and Python 3.8

If you get the ZipInfo objects of a ZIP file that is larger than 2GiB, then all 
the ZipInfo entries with a header offset > 2G will report phantom 'extra' data.

import zipfile
zipname = "reallybig.zip"
z = zipfile.ZipFile( zipname )
zi = z.infolist()
for inf in zi:
  print( inf.filename, inf.header_offset, inf.extra )  

And observe that:
* All entries with offset < 2G will report no extra field.
* All entries with offset > 2G will report extra field.

It's hard to package this up as a self-contained test, because it requires a 
very large zip to test.

--
components: IO
messages: 359762
nosy: Bram Stolk
priority: normal
severity: normal
status: open
title: zipfile.ZipInfo objects contain invalid 'extra' fields.
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



[issue39289] crypt.crypt fail with OSError "[Errno 22] Invalid argument" on 3.9 where it didn't on 3.8

2020-01-10 Thread Vinay Sajip


Vinay Sajip  added the comment:

It appears that a check for the return value from the crypt/crypt_r primitives 
was added to fix bpo-38402. So, this is expected behaviour in Python 3.9. 
Change was in

https://github.com/python/cpython/commit/0d3fe8ae4961bf551e7d5e42559e2ede1a08fd7c

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



[issue39292] syslog constants behind rfc

2020-01-10 Thread Vinay Sajip


Vinay Sajip  added the comment:

> can this issue be closed?

Not quite yet. Waiting for feedback from the original reporter as to whether 
this change meets the requirements. I've also treated this as an enhancement 
rather than a bug, and so I am not currently planning to back-port these 
changes. I will close this issue once I get feedback.

--

___
Python tracker 

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



[issue19557] ast - docs for every node type are missing

2020-01-10 Thread Batuhan


Batuhan  added the comment:

@pablogsal is working on documenting nodes (not every node type that exists, 
the ones that aren't deprecated) in PR 17812

--
nosy: +BTaskaya, pablogsal

___
Python tracker 

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



[issue39292] syslog constants behind rfc

2020-01-10 Thread Batuhan


Batuhan  added the comment:

@vinay.sajip PR 17945 looks resolved this, can this issue be closed?

--
nosy: +BTaskaya

___
Python tracker 

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



[issue39247] dataclass defaults and property don't work together

2020-01-10 Thread Juan Arrivillaga


Juan Arrivillaga  added the comment:

So, after glancing at the source code:
https://github.com/python/cpython/blob/ce54519aa09772f4173b8c17410ed77e403f3ebf/Lib/dataclasses.py#L869

During this processing of fields, couldn't you just special case 
property/descriptor objects?

--
nosy: +juanpa.arrivillaga

___
Python tracker 

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



[issue39293] Windows 10 64-bit needs reboot

2020-01-10 Thread Tony


New submission from Tony :

After installing python 3.8.1 64-bit, on Windows 10 64-bit version 1909, the 
system needs to be rebooted to validate all settings in the registry. Otherwise 
will cause a lot of exceptions, like Path not found etc.

--
components: Installation
messages: 359756
nosy: ToKa
priority: normal
severity: normal
status: open
title: Windows 10 64-bit needs reboot
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



[issue4347] Circular dependency causes SystemError when adding new syntax

2020-01-10 Thread Brett Cannon


Brett Cannon  added the comment:

Pablo, is this still an issue?

--
nosy: +pablogsal

___
Python tracker 

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



[issue4347] Circular dependency causes SystemError when adding new syntax

2020-01-10 Thread Brett Cannon


Change by Brett Cannon :


--
resolution: wont fix -> 

___
Python tracker 

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



[issue2636] Adding a new regex module (compatible with re)

2020-01-10 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue1674555] sys.path in tests contains system directories

2020-01-10 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue1531415] parsetok.c emits warnings by writing to stderr

2020-01-10 Thread Brett Cannon


Brett Cannon  added the comment:

Pablo, is this still a thing to care about?

--
nosy: +pablogsal

___
Python tracker 

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



[issue1596321] KeyError at exit after 'import threading' in other thread

2020-01-10 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue34297] Windows py.exe launcher fail to handle quote correctly

2020-01-10 Thread Maxime Belanger


Change by Maxime Belanger :


--
nosy: +Maxime Belanger

___
Python tracker 

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



[issue39288] Add math.nextafter(a, b)

2020-01-10 Thread Mark Dickinson


Mark Dickinson  added the comment:

I'm not opposed to some form of this by any means, but I fear there's some 
bikeshedding to go through, both on the name and the functionality (one 
function with two arguments, or two functions each taking a single argument?).

C 99 prescribes "nextafter" and "nexttoward" (which is pretty much the same as 
"nextafter" if you don't care about the distinction between float, double and 
long double).

IEEE 754, on the other hand, requires instead nextUp and nextDown, which take a 
single argument and move towards +inf or -inf (respectively).

Python's Decimal type has a two-argument next_toward method.

NumPy has nextafter.

Java provides all three of nextUp, nextDown and nextAfter.

For sure implementing nextafter is easiest, since we can just wrap the C 
version. That doesn't *necessarily* make it the right variant to go for.

(Annoyingly enough, none of these is actually what I tend to want in practice, 
which is "next larger" and "next smaller" functions, or more precisely, 
nextAwayFromZero and nextTowardsZero functions. nextTowardsZero is of course a 
special case of nextafter, but nextAwayFromZero doesn't match any of these.)

--
nosy: +tim.peters

___
Python tracker 

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



[issue39289] crypt.crypt fail with OSError "[Errno 22] Invalid argument" on 3.9 where it didn't on 3.8

2020-01-10 Thread Vinay Sajip


Vinay Sajip  added the comment:

Another data point: both failing machines were VMware virtual machines.

--

___
Python tracker 

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



[issue39289] crypt.crypt fail with OSError "[Errno 22] Invalid argument" on 3.9 where it didn't on 3.8

2020-01-10 Thread Vinay Sajip


Vinay Sajip  added the comment:

I can also reproduce it on Ubuntu 16.04.6 LTS (the first Ubuntu was the Linux 
Mint version based on Ubuntu 18.04).

--

___
Python tracker 

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



[issue39292] syslog constants behind rfc

2020-01-10 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset ce54519aa09772f4173b8c17410ed77e403f3ebf by Vinay Sajip in branch 
'master':
bpo-39292: Add missing syslog facility codes. (GH-17945)
https://github.com/python/cpython/commit/ce54519aa09772f4173b8c17410ed77e403f3ebf


--

___
Python tracker 

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



[issue39257] contextvars.Context.run hangs forever in ProccessPoolExecutor

2020-01-10 Thread Yury Selivanov


Yury Selivanov  added the comment:

> This throws 'cannot pickle Context' 

Yes, this is expected. contextvars are not compatible with multiprocessing.

>  This hangs forever *

This hanging part is weird, and most likely hints at a bug in multiprocessing.

--

___
Python tracker 

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



[issue39257] contextvars.Context.run hangs forever in ProccessPoolExecutor

2020-01-10 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue39292] syslog constants behind rfc

2020-01-10 Thread Vinay Sajip


Change by Vinay Sajip :


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

___
Python tracker 

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



[issue39204] Automate adding Type Annotations to Documentation

2020-01-10 Thread Ivan Levkivskyi


Change by Ivan Levkivskyi :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2020-01-10 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Closing as won't fix.  If you feel strongly about this, I would suggest to 
bring the discussion on python-dev: 
https://mail.python.org/mailman3/lists/python-dev.python.org/

--
resolution:  -> wont fix
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



[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2020-01-10 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Ahah. Nice catch!

Well, it's a pity this got overlooked when we added Path.link_to().  But I'm 
afraid it's late to change it now, since this has been released, and changing 
the argument order would break existing code in potentially dangerous ways.

Note the original issue where this was added was issue26978.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue39292] syslog constants behind rfc

2020-01-10 Thread SilentGhost


Change by SilentGhost :


--
type:  -> behavior
versions:  -Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2020-01-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +pitrou

___
Python tracker 

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



[issue39292] syslog constants behind rfc

2020-01-10 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue39292] syslog constants behind rfc

2020-01-10 Thread Ryan


New submission from Ryan :

When using the SysLogHandler 
(https://docs.python.org/3/library/logging.handlers.html#logging.handlers.SysLogHandler)
 the supported facilities appear to be lagging the RFC (5454 ?), or at least 
what is being supported in other mainstream languages. I Specifically need 
LOG_AUDIT and LOG_NTP but there are a couple others. The syslog "openlog" 
function takes an INT but not sure how to get an INT through the python 
SysLogHandler because it's based on a static list of names and symbolic values.
Wikipedia (https://en.wikipedia.org/wiki/Syslog#Facility) suggests LOG_AUTH and 
LOG_NTP are in the RFC. 
This is my first ticket here so hopefully this is the right place for it. Maybe 
there is a workaround or some re-education needed on my part...

--
components: Library (Lib)
messages: 359746
nosy: tryanunderw...@gmail.com
priority: normal
severity: normal
status: open
title: syslog constants behind rfc
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



[issue39291] "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed usage

2020-01-10 Thread Rockmizu


New submission from Rockmizu :

Python version: Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC 
v.1916 64 bit (AMD64)] on win32

The usage of symlink_to() is link.symlink_to(target)
while the usage of link_to() is target.link_to(link).
This could be confusing.

Here is an example:

>>> import pathlib
>>> target = pathlib.Path('target.txt')
>>> p1 = pathlib.Path('symlink.txt')
>>> p2 = pathlib.Path('hardlink.txt')
>>> p1.symlink_to(target)
>>> p2.link_to(target)  # expected usage
Traceback (most recent call last):
  File "", line 1, in 
  File "D:\Program Files\Python38\lib\pathlib.py", line 1346, in link_to
self._accessor.link_to(self, target)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 
'hardlink.txt' -> 'target.txt'
>>> target.link_to(p2)  # current usage
>>>

Since os.symlink() and os.link() have the same argument order,

>>> import os
>>> os.symlink('target.txt', 'symlink.txt')
>>> os.link('target.txt', 'hardlink.txt')
>>>

it would be nicer if the pathlib has the same argument order too.

--
components: Library (Lib)
messages: 359745
nosy: Rockmizu
priority: normal
severity: normal
status: open
title: "pathlib.Path.link_to()" and "pathlib.Path.symlink_to()" have reversed 
usage
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



[issue39284] Flexible indentation

2020-01-10 Thread Eric V. Smith


Eric V. Smith  added the comment:

Please discuss this idea on the python-ideas mailing list first. It would also 
certainly require a PEP.

But I don't want to get your hopes up: there's almost no chance that this would 
be accepted.

I'm going to close this issue. If the idea gains any traction, we can re-open 
it.

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



[issue39290] lib2to3.fixes.fix_import: support imports_as_name in traverse_imports

2020-01-10 Thread Batuhan


Change by Batuhan :


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

___
Python tracker 

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



[issue39241] Popen of python3.6 hangs on os.read(errpipe_read, 50000)

2020-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

I have no clue. Try to attach a debugger and try to inspect the Python frames. 
You can use gdb with python-gdb.py for that, for example. Or play with 
faulthandler, especially faulthandler.dump_traceback_later().

--

___
Python tracker 

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



[issue39290] lib2to3.fixes.fix_import: support imports_as_name in traverse_imports

2020-01-10 Thread Batuhan


New submission from Batuhan :

I've been working on custom lib2to3 fixers and I use some of the already 
definied utilites inside the fixers. But traverse_imports can't traverse from 
import names, which is pretty simple and straight forward to implement.

--
messages: 359742
nosy: BTaskaya
priority: normal
severity: normal
status: open
title: lib2to3.fixes.fix_import: support imports_as_name in traverse_imports

___
Python tracker 

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



[issue39241] Popen of python3.6 hangs on os.read(errpipe_read, 50000)

2020-01-10 Thread Xu


Xu  added the comment:

Thanks Stinner.

Do you have some clues about this issue ?
In my case, our test system use Popen to start a few infrastructure processes 
for tests going. After tests done we will kill all processes and start again 
for new round.

Most of time it works fine.  However we have some chances where one Popen hangs 
on "os.read(errpipe_read, 5) forever.

The close_fd is always true.

I guess there is some subtle issue here.

--

___
Python tracker 

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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2020-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

> I'd like for Python to provide a portable implementation of strftime instead 
> of just documenting that the version isn't portable.

If someone wants to do that, I suggest to first start with a project on PyPI. 
It sounds like a tricky project. Date, time, locales and localization are hard 
problems!

--

___
Python tracker 

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



[issue39259] poplib.POP3/POP3_SSL should reject timeout = 0 (non-blocking mode)

2020-01-10 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +17351
pull_request: https://github.com/python/cpython/pull/17939

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

Backport PRs are ready for 3.7 and 3.8. Question: is there a risk of breaking 
the backward compatibility if a project unit test rely on the exact error 
message? If yes, maybe it's better to reject the backports and close this issue 
(only change the error message in 3.9).

--

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17350
pull_request: https://github.com/python/cpython/pull/17943

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17349
pull_request: https://github.com/python/cpython/pull/17942

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17348
pull_request: https://github.com/python/cpython/pull/17941

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-10 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17347
pull_request: https://github.com/python/cpython/pull/17940

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-10 Thread Dong-hee Na


Dong-hee Na  added the comment:

Victor: Changes are only correcting the message.
I am +1 on backporting :)

--

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

Dong-hee, Pablo: Should we backport the two fixes to 3.7 and 3.8 branches? IMHO 
yes, we should backport.

--

___
Python tracker 

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



[issue39200] Fix inaccurate TypeError messages when calling with insufficient arguments

2020-01-10 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset abdc634f337ce4943cd7d13587936837aac2ecc9 by Victor Stinner 
(Dong-hee Na) in branch 'master':
bpo-39200: Correct the error message for min/max builtin function (GH-17814)
https://github.com/python/cpython/commit/abdc634f337ce4943cd7d13587936837aac2ecc9


--
nosy: +vstinner

___
Python tracker 

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



[issue13305] datetime.strftime("%Y") not consistent for years < 1000

2020-01-10 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

In issue39103, I filed a bug relating to this issue.

I'd like for Python to provide a portable implementation of strftime instead of 
just documenting that the version isn't portable.

Given that this ticket assigned to 'docs' suggests that a portable version is 
out of the question. Can we expand the scope of this issue to actually 
providing a portable version?

--
nosy: +jaraco

___
Python tracker 

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



[issue39289] crypt.crypt fail with OSError "[Errno 22] Invalid argument" on 3.9 where it didn't on 3.8

2020-01-10 Thread Dong-hee Na


Dong-hee Na  added the comment:

I also fail to reproduce the issue on the master branch of Python on macOS.

--
nosy: +corona10

___
Python tracker 

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



[issue39289] crypt.crypt fail with OSError "[Errno 22] Invalid argument" on 3.9 where it didn't on 3.8

2020-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
title: crypt.crypt crashes on 3.9 where it didn't on 3.8 -> crypt.crypt fail 
with OSError "[Errno 22] Invalid argument" on 3.9 where it didn't on 3.8

___
Python tracker 

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



[issue39289] crypt.crypt crashes on 3.9 where it didn't on 3.8

2020-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

I fail to reproduce the issue on the master branch of Python on Fedora 31.

--
nosy: +vstinner

___
Python tracker 

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



[issue39289] crypt.crypt crashes on 3.9 where it didn't on 3.8

2020-01-10 Thread Vinay Sajip


New submission from Vinay Sajip :

The following script (cryptest.py):

import crypt

for salt in ('foo', 
'$2a$04$5BJqKfqMQvV7nS.yUguNcueVirQqDBGaLXSqj.rs.pZPlNR0UX/HK'):
t = 'test'
h = crypt.crypt(t, salt)
print("'%s' with '%s' -> %s" % (t, salt, h))

crashes in 3.9, whereas it doesn't in earlier versions:

$ python2.7 cryptest.py 
'test' with 'foo' -> foy6TgL.HboTE
'test' with '$2a$04$5BJqKfqMQvV7nS.yUguNcueVirQqDBGaLXSqj.rs.pZPlNR0UX/HK' -> 
None
$ python3.7 cryptest.py 
'test' with 'foo' -> foy6TgL.HboTE
'test' with '$2a$04$5BJqKfqMQvV7nS.yUguNcueVirQqDBGaLXSqj.rs.pZPlNR0UX/HK' -> 
None
$ python3.8 cryptest.py 
'test' with 'foo' -> foy6TgL.HboTE
'test' with '$2a$04$5BJqKfqMQvV7nS.yUguNcueVirQqDBGaLXSqj.rs.pZPlNR0UX/HK' -> 
None
$ python3.9 cryptest.py 
'test' with 'foo' -> foy6TgL.HboTE
Traceback (most recent call last):
  File "/home/vinay/projects/scratch/cpython/cryptest.py", line 5, in 
h = crypt.crypt(t, salt)
  File "/home/vinay/.local/lib/python3.9/crypt.py", line 82, in crypt
return _crypt.crypt(word, salt)
OSError: [Errno 22] Invalid argument

This is on Ubuntu 18.04, 64-bit.

--
components: Library (Lib)
keywords: 3.9regression
messages: 359732
nosy: vinay.sajip
priority: normal
severity: normal
status: open
title: crypt.crypt crashes on 3.9 where it didn't on 3.8
versions: Python 3.9

___
Python tracker 

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



[issue18233] SSLSocket.getpeercertchain()

2020-01-10 Thread Chris Burr


Change by Chris Burr :


--
pull_requests: +17346
pull_request: https://github.com/python/cpython/pull/17938

___
Python tracker 

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



[issue39288] Add math.nextafter(a, b)

2020-01-10 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue39288] Add math.nextafter(a, b)

2020-01-10 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +3.3regression
nosy: +lemburg, mark.dickinson, rhettinger, stutzbach

___
Python tracker 

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



[issue39288] Add math.nextafter(a, b)

2020-01-10 Thread STINNER Victor


New submission from STINNER Victor :

Linux manual page of nextafter():
"""
The nextafter() function return the next representable floating-point  value 
following x in the direction of y.  If y is less than x, these functions will 
return the largest representable number less than x.

If x equals y, the functions return y.
"""

I used this function to round an integer towards zero when casting a float to 
an integer in bpo-39277. Example in C:

#include 
#include 
#include 
int main()
{
int64_t int64_max = 9223372036854775807LL;
double d = (double)int64_max;  /* ROUND_HALF_EVEN */
double d2 = nextafter(d, 0.0);
printf("i = %ld\n", int64_max);
printf("d = %.0f\n", d);
printf("d2 = %.0f\n", d2);
printf("d - d2 = %.0f\n", d - d2);
return 0;
}

Output:

i = 9223372036854775807
d = 9223372036854775808
d2 = 9223372036854774784
d - d2 = 1024

The function exists in numpy:

numpy.nextafter(x1, x2, /, out=None, *, where=True, casting='same_kind', 
order='K', dtype=None, subok=True[, signature, extobj]) = 

Return the next floating-point value after x1 towards x2, element-wise.

https://docs.scipy.org/doc/numpy/reference/generated/numpy.nextafter.html


Attached PR adds math.nextafter().

--
components: Library (Lib)
messages: 359731
nosy: vstinner
priority: normal
severity: normal
status: open
title: Add math.nextafter(a, b)
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



[issue39280] Don't allow datetime parsing to accept non-Ascii digits

2020-01-10 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> If all we're going to do is 
> switch [0-9] to \d (which won't work for the places where it's 
> actually [1-9], mind you)

Ah, that's a good point.

[...]
> we're better off resolving the 
> inconsistency by requiring ASCII digits and considering non-ASCII 
> support to be a separate feature request.

This seems reasonable.

--

___
Python tracker 

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



[issue39280] Don't allow datetime parsing to accept non-Ascii digits

2020-01-10 Thread Paul Ganssle

Paul Ganssle  added the comment:

> Yes, but not within the same format. If someone were to choose the format 
> '2014-04-10T24:00:00', they would have a reasonable expectation that there is 
> only one unique string that corresponds with that datetime

That's a particularly bad example, because it's exactly the same as another 
string with the exact same format:

  2014-04-11T00:00:00

Since ISO 8601 allows you to specify midnight (and only midnight) using 
previous day + 24:00. Admittedly, that is the only ambiguity I know of offhand 
(though it's a huge spec) *for a given format*, but also ISO 8601 does not 
really have a concept of format specifiers, so it's not like there's a way to 
unambiguously specify the format you are intending to use.

Either way, I think we can explicitly dispense with "there will be an exact 
mapping between a given (format_str, datetime_str) pair and the datetime it 
produces" as a goal here. I can't think of any good reason you'd want that 
property, nor have we made any indication that I can see that we provide it 
(probably the opposite, since there are some formats that explicitly ignore 
whitespace).

> Okay, since it seems like I'm the only one who wants this change, I'll let it 
> go. Thanks for your input.

I wouldn't go that far. I think I am +0 or +1 on this change, I just wanted to 
be absolutely clear *why* we're doing this. I don't want someone pointing at 
this thread in the future and saying, "Core dev says that it's a bug in their 
code if they don't follow X standard / if more than one string produces the 
same datetime / etc".

I think the strongest argument for making this or a similar change is that I'm 
fairly certain that we don't have the bandwidth to handle internationalized 
dates and I don't think we have much to gain by doing a sort of half-assed 
version of that by accepting unicode transliterations of numerals and calling 
it a day. I think there are tons of edge cases here that could bite people, and 
if we don't support this *now* I'd rather give people an error message early in 
the process and try to point people at a library that is designed to handle 
datetime localization issues. If all we're going to do is switch [0-9] to \d 
(which won't work for the places where it's actually [1-9], mind you), I think 
people will get a better version of that with something like:

  def normalize_dt_str(dt_str):
  return "".join(str(int(x)) if x.isdigit() else x
 for x in dt_str)

There are probably more robust and/or faster versions of this, but it's 
probably roughly equivalent to what we'd be doing here *anyway*, and at least 
people would have to opt-in to this.

I am definitely open to us supporting non-ASCII digits in strptime if it would 
be useful at the level of support we could provide, but given that it's 
currently broken for any reasonable use case and as far as I know no one has 
complained, we're better off resolving the inconsistency by requiring ASCII 
digits and considering non-ASCII support to be a separate feature request.

CC-ing Inada on this as unicode guru and because he might have some intuition 
about how useful non-ASCII support might be. The only place I've seen non-ASCII 
dates is in Japanese graveyards, and those tend to use Chinese numerals (which 
don't match \d anyway), though Japanese and Korean also tends to make heavier 
use of "full-width numerals" block, so maybe parsing something like 
"2020-02-02" is an actual pain point that would be improved by this change 
(though, again, I suspect that this is just the beginning of the required 
changes and we may never get a decent implementation that supports unicode 
numerals).

--
nosy: +inada.naoki

___
Python tracker 

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



[issue39277] _PyTime_FromDouble() fails to detect an integer overflow when converting a C double to a C int64_t

2020-01-10 Thread STINNER Victor


STINNER Victor  added the comment:

Similar issue in HHVM:

* https://github.com/facebook/hhvm/issues/5932
* https://github.com/PPC64/hhvm/commit/7cdb76b4f495aa7aa40a696379862916c27f5828

--

___
Python tracker 

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



[issue39259] poplib.POP3/POP3_SSL should reject timeout = 0 (non-blocking mode)

2020-01-10 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c39b52f1527868c7ada9385669c38edf98858921 by Victor Stinner 
(Dong-hee Na) in branch 'master':
bpo-39259: poplib now rejects timeout = 0 (GH-17912)
https://github.com/python/cpython/commit/c39b52f1527868c7ada9385669c38edf98858921


--

___
Python tracker 

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



[issue39259] poplib.POP3/POP3_SSL should reject timeout = 0 (non-blocking mode)

2020-01-10 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +17344
pull_request: https://github.com/python/cpython/pull/17936

___
Python tracker 

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



  1   2   >