[issue37303] Rename parameter name of imghdr what

2019-06-15 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

file can be a positional or keyword argument. Someone might be using it as a 
keyword argument and this would require a deprecation period before renaming 
could be done.

./python.exe
Python 3.9.0a0 (heads/master:7a68f8c28b, Jun 15 2019, 21:00:05)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import inspect, imghdr
>>> imghdr.what(file="README.rst")
>>> imghdr.what("README.rst")
>>> inspect.signature(imghdr.what).parameters['file'].kind.description
'positional or keyword'

--
nosy: +xtreak
versions:  -Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue37302] Add an "onerror" callback parameter to the tempfile.TemporaryDirectory member functions

2019-06-15 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue37303] Rename parameter name of imghdr what

2019-06-15 Thread Dong-hee Na


New submission from Dong-hee Na :

Still 
https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/imghdr.py#L11
 signature is def what(file, h=None).

I 'd like to suggest to update it into def what(filename, h=None)
Also, the doc of imghdr represents it as the filename.
https://docs.python.org/3/library/imghdr.html

note that sndhdr is already using this name.
https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/sndhdr.py#L52

If this proposal is accepted, I'd like to send a patch for it.

--
components: Library (Lib)
messages: 345727
nosy: corona10
priority: normal
severity: normal
status: open
title: Rename parameter name of imghdr what
type: enhancement
versions: 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



[issue37302] Add an "onerror" callback parameter to the tempfile.TemporaryDirectory member functions

2019-06-15 Thread Jeffrey Kintscher


New submission from Jeffrey Kintscher :

Add an "onerror" callback parameter to the tempfile.TemporaryDirectory member 
functions so that the caller can perform special handling for directory items 
that it can't automatically delete. The caller created the undeletable 
directory entries, so it is reasonable to believe the caller may know how to 
unmake what they made.

This enhancement is needed to provide the desired behavior described in issue 
#29982 and issue #36422.

--
messages: 345726
nosy: Jeffrey.Kintscher, giampaolo.rodola, gvanrossum, josh.r, max, paul.moore, 
riccardomurri, serhiy.storchaka, steve.dower, tarek, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Add an "onerror" callback parameter to the tempfile.TemporaryDirectory 
member functions

___
Python tracker 

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



[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-15 Thread vsbogd


vsbogd  added the comment:

Analysis:

self.rfile.read(nbytes)

https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/http/server.py#L1207

Doesn't read full content of the file but only first chunk because self.rfile 
is not BufferedIO instance. In fact it is SocketIO instance. The reason is that 
CGIHTTPServer sets rbufsize to 0:

# Make rfile unbuffered -- we need to read one line and then pass
# the rest to a subprocess, so we can't use buffered input.
rbufsize = 0

https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/http/server.py#L975-L977

So the minimal fix is to set rbufsize back to -1 again. This fix requires one 
more change, because code below:

# throw away additional data [see bug #427345]
while select.select([self.rfile._sock], [], [], 0)[0]:
if not self.rfile._sock.recv(1):
break

https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/http/server.py#L1210-L1213

expects self.rfile instance to be SocketIO. 

This could be fixed by replacing this code by:


So the minimal fix is to set rbufsize back to -1 again. This fix requires one 
more change, because code below:

# throw away additional data [see bug #427345]
while select.select([self.rfile], [], [], 0)[0]:
if not self.rfile.read(1):
break

like it is implemented in another branch of the condition check:

https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/http/server.py#L1163-L1166

--

___
Python tracker 

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



[issue37301] CGIHTTPServer doesn't handle long POST requests

2019-06-15 Thread vsbogd


New submission from vsbogd :

Steps to reproduce: Use POST request with "multipart/form-data" encoding to 
pass long (more than 64KiB) file to the CGI script.
Expected result: Script receives the whole file.
Actual result: Script receives only first part which size is about size of the 
TCP packet.

Scripts to test issue are attached. To run test execute:
$ python test_cgi_server.py &
$ python test_cgi_client.py 
$ kill %1

--
components: Library (Lib)
files: test_cgi.zip
messages: 345724
nosy: vsbogd
priority: normal
severity: normal
status: open
title: CGIHTTPServer doesn't handle long POST requests
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file48423/test_cgi.zip

___
Python tracker 

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



[issue37300] a Py_XINCREF in classobject.c are not necessary

2019-06-15 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue37300] a Py_XINCREF in classobject.c are not necessary

2019-06-15 Thread hai shi


Change by hai shi :


--
components: Interpreter Core
nosy: shihai1991
priority: normal
severity: normal
status: open
title: a Py_XINCREF in classobject.c are not necessary
type: enhancement

___
Python tracker 

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



[issue37299] RuntimeWarning is NOT raised

2019-06-15 Thread YoSTEALTH


New submission from YoSTEALTH :

from asyncio import run


async def true():
return True


async def false():
return False


async def error():
a = false()
b = true()
return await (a or b)
# Good Error
#   "RuntimeWarning: coroutine 'true' was never awaited print(await 
error())"


async def no_error():
return await (false() or true())  # False
# Bad Problem
#   `RuntimeWarning` is not raised for 'true'.

# Note
#   The correct syntax is `return (await false()) or (await true()) as it 
should return `True`
#   not `False`


async def test():
print(await no_error())  # False
print(await error()) # RuntimeWarning(...), False


if __name__ == '__main__':
run(test())


- Tested in Python 3.8.0b1
- Why does `error()` return `RuntimeWarning` but `no_error()` does not?

--
components: asyncio
messages: 345723
nosy: YoSTEALTH, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: RuntimeWarning is NOT raised
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



[issue37298] IDLE: Revise html to tkinker converter for help.html

2019-06-15 Thread Terry J. Reedy


New submission from Terry J. Reedy :

Sphinx 2.? generates different html than 1.8 such that the display of  
Help ==> IDLE Help has extra blank lines. Among possibly other things, the 
contents of ... is wrapped in ... and blank lines appear 
between the bullet and text.
 

-coded in 100% pure Python, using the tkinter GUI toolkit
-cross-platform: works mostly the same on Windows, Unix, and macOS
...
+coded in 100% pure Python, using the tkinter GUI toolkit
+cross-platform: works mostly the same on Windows, Unix, and 
macOS
...
 

A similar issue afflicts the menu, with blank lines between the menu item and 
the explanation.

The html original 3x/Doc/build/html/library/idle.html#index-0 looks normal in 
Firefox.  The html parser class in help.py needs to ignore  within .  It 
should specify which version of Sphinx it is compatible with.

Do any of you have any idea what the html change might be about?  Is there 
something wrong with idle.rst?

--
assignee: terry.reedy
components: IDLE
messages: 345722
nosy: cheryl.sabella, markroseman, mdk, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE: Revise html to tkinker converter for help.html
type: behavior
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



[issue37297] function changed when pickle bound method object

2019-06-15 Thread George Xie


New submission from George Xie :

if we create a bound method object `f` with function object `A.f` and instance 
object `B()`,
when pickling this bound method object:

import pickle

class A():
def f(self):
pass

class B():
def f(self):
pass

o = B()
f = A.f.__get__(o)
pf = pickle.loads(pickle.dumps(f))
print(f)
print(pf)

we get:

>
>

the underlaying function are lost, changed from `A.f` to `B.f`.

as pickle calls `__reduce__` method of `method object`, IMO [its 
implementation][1] simply ignored the real function, whcih is not right.

I have tried a [wordaround][2]:

import types
import copyreg

def my_reduce(obj):
return (obj.__func__.__get__, (obj.__self__,))

copyreg.pickle(types.MethodType, my_reduce)


[1]: https://github.com/python/cpython/blob/v3.7.3/Objects/classobject.c#L75-L89
[2]: https://stackoverflow.com/a/56614748/4201810

--
components: Library (Lib)
messages: 345721
nosy: georgexsh
priority: normal
severity: normal
status: open
title: function changed when pickle bound method object
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



[issue32846] Deletion of large sets of strings is extra slow

2019-06-15 Thread Tim Peters


Tim Peters  added the comment:

Thanks, Terry!  Based on your latest results, "quadratic time" isn't plausible 
here anymore, so I'm closing this.  Nasty cache effects certainly played a 
role, but they were just a flea on the dog ;-)

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



[issue37260] shutil.rmtree() FileNotFoundError race condition

2019-06-15 Thread Jeffrey Kintscher


Jeffrey Kintscher  added the comment:

The PR is ready for review.

--

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread STINNER Victor


STINNER Victor  added the comment:

I don't understand if this issue is a recent regression or not. Python 3.7 has 
been modified, but the reporter only mentions Python 3.8.

I concur with Serhiy, a test is needed to prevent future regressions on this 
fix.

--

___
Python tracker 

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



[issue37294] concurrent.futures.ProcessPoolExecutor and multiprocessing.pool.Pool fail with super

2019-06-15 Thread Géry

Géry  added the comment:

And like the `concurrent.futures` module for 
`concurrent.futures.ProcessPoolExecutor` but not for 
`concurrent.futures.ThreadPoolExecutor` (see above), the `multiprocessing.pool` 
module seems also affected by a similar problem for `multiprocessing.pool.Pool` 
(process pools) but not for `multiprocessing.pool.ThreadPool` (thread pools).

Indeed the following code:

import multiprocessing.pool

class A:
def f(self):
print("called")

class B(A):
def f(self):
pool = multiprocessing.pool.Pool(2)
pool.apply(super().f)

if __name__ == "__main__":
B().f()

raises the following exception:

> AssertionError: daemonic processes are not allowed to have children

--
title: ProcessPoolExecutor fails with super -> 
concurrent.futures.ProcessPoolExecutor and multiprocessing.pool.Pool fail with 
super

___
Python tracker 

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



[issue37271] Make multiple passes of the peephole optimizer until bytecode cannot be optimized further

2019-06-15 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> tim.peters

___
Python tracker 

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



[issue37294] ProcessPoolExecutor fails with super

2019-06-15 Thread Géry

Géry  added the comment:

@Andrew Svetlov

Well this was just an example for illustrating the issue. In real code I need 
this to create `ThreadPoolMixin` and `ProcessPoolMixin` classes (similar to the 
`socketserver.ThreadingMixIn` and `socketserver.ForkingMixIn` classes in the 
standard library, but using a thread/process pool with a fixed size instead of 
creating a new thread/process per request) for mixing with my server classes. 
But because of this `ProcessPoolExecutor` issue, I cannot use my 
`ProcessPoolMixin` class but only my `ThreadPoolMixin` currently.

The fact is one cannot submit a parent method call to a `ProcessPoolExecutor`.

This code snippet prints the exception raised by the call:

from concurrent.futures import ProcessPoolExecutor

class A:
def f(self):
print("called")

class B(A):
def f(self):
executor = ProcessPoolExecutor(max_workers=2)
print(executor.submit(super().f).exception())

if __name__ == "__main__":
B().f()

It prints this:

> [Errno 24] Too many open files
> None
> None
> None
> …

--

___
Python tracker 

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



[issue37271] Make multiple passes of the peephole optimizer until bytecode cannot be optimized further

2019-06-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I afraid that the time of the peephole optimization is nothing in comparison 
with the cost of deduplicating constants in compile.c.

--

___
Python tracker 

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



[issue37294] ProcessPoolExecutor fails with super

2019-06-15 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue37294] ProcessPoolExecutor fails with super

2019-06-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

The use case is weird.
I don't think we need to do something with the issue.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue37271] Make multiple passes of the peephole optimizer until bytecode cannot be optimized further

2019-06-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm familiar with the trade-offs (I'm the original designer of this code), but 
it is possible to use that reasoning to talk yourself into thinking that any 
optimization to code generation is worth it.  

The speed of the compile does matter as well (think about uses of exec() in 
dataclasses for example).  Also, the level of complexity matters as well.  The 
last time we introduced recursive passes for part of the peepholer (in constant 
folding), it took years to get it fully debugged and it caused a number of bug 
reports with respect to total compilation time.

FWIW, Guido was never sold on the merits of having a peephole optimizer and the 
tool spent much of its life on the verge of being ripped-out.  To accommodate 
his wishes and our design instincts, we agreed at the outset to keep this "dirt 
simple".  (Put another way, for over a decade every developer who looked at 
this resisted going down this obvious line of development).

That said, I'll leave it to Tim to decide.  He helped talked Guido into letting 
me add this and he is the one who first proposed setting tight limits on how 
far we would go.

(One last thought, be sure to coordinate with Serhiy who is actively 
transferring responsibilities upstream to the AST level manipulations so they 
can be analyzed at a higher level.)

--

___
Python tracker 

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



[issue37294] ProcessPoolExecutor fails with super

2019-06-15 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue37296] pdb next vs __next__

2019-06-15 Thread Rick


New submission from Rick :

Don't know how to get version from pdb, Makefile says 2.7

Code runs but when debugging I get an error that an iterator has no next() 
function.  It has got a __next__() function, and it runs, just not under pdb.

If I create a spurious next() function, pdb runs, and calls the __next__() 
function.

--
messages: 345712
nosy: tsingi
priority: normal
severity: normal
status: open
title: pdb next vs __next__
type: behavior

___
Python tracker 

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



[issue37295] Possible optimizations for math.comb()

2019-06-15 Thread Raymond Hettinger


New submission from Raymond Hettinger :

The implementation of math.comb() is nice in that it limits the size of 
intermediate values as much as possible and it avoids unnecessary steps when 
min(k,n-k) is small with respect to k.

There are some ways it can be made better or faster:

1) For small values of n, there is no need to use PyLong objects at every step. 
 Plain C integers would suffice and we would no longer need to make repeated 
allocations for all the intermediate values.  For 32-bit builds, this could be 
done for n<=30.  For 64-bit builds, it applies to n<=62.  Adding this fast path 
would likely give a 10x to 50x speed-up.

2) For slightly larger values of n, the computation could be sped-up by 
precomputing one or more rows of binomial coefficients (perhaps for n=75, 
n=150, and n=225).  The calculation could then start from that row instead of 
from higher rows on Pascal's triangle.   

For example comb(100, 55) is currently computed as:
comb(55,1) * 56 // 2 * 57 // 3 ... 100 // 45<== 45 steps

Instead, it could be computed as:
comb(75,20) * 76 // 21 * 77 // 22 ... 100 / 45  <== 25 steps
   ^-- found by table lookup 

This gives a nice speed-up in exchange for a little memory in an array of 
constants (for n=75, we would need an array of length 75//2 after exploiting 
symmetry).  Almost all cases would should show some benefit and in favorable 
cases like comb(76, 20) the speed-up would be nearly 75x.

3) When k is close to n/2, the current algorithm is slower than just computing 
(n!) / (k! * (n-k)!). However, the factorial method comes at the cost of more 
memory usage for large n.  The factorial method consumes memory proportional to 
n*log2(n) while the current early-cancellation method uses memory proportional 
to n+log2(n).  Above some threshold for memory pain, the current method should 
always be preferred.  I'm not sure the factorial method should be used at all, 
but it is embarrassing that factorial calls sometimes beat the current C 
implementation:

$ python3.8 -m timeit -r 11 -s 'from math import comb, factorial as fact' 
-s 'n=100_000' -s 'k = n//2' 'comb(n, k)'
1 loop, best of 11: 1.52 sec per loop
$ python3.8 -m timeit -r 11 -s 'from math import comb, factorial as fact' 
-s 'n=100_000' -s 'k = n//2' 'fact(n) // (fact(k) * fact(n-k))'
1 loop, best of 11: 518 msec per loop

4) For values such as n=1_000_000 and k=500_000, the running time is very long 
and the routine doesn't respond to SIGINT.  We could add checks for keyboard 
interrupts for large n.  Also consider releasing the GIL.

5) The inner-loop current does a pure python subtraction than could in many 
cases be done with plain C integers.  When n is smaller than maxsize, we could 
have a code path that replaces "PyNumber_Subtract(factor, _PyLong_One)" with 
something like "PyLong_FromUnsignedLongLong((unsigned long long)n - i)".

--
components: Library (Lib)
messages: 345711
nosy: mark.dickinson, pablogsal, rhettinger, serhiy.storchaka, tim.peters
priority: normal
severity: normal
status: open
title: Possible optimizations for math.comb()
type: performance
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



[issue33972] AttributeError in email.message.iter_attachments()

2019-06-15 Thread Abhilash Raj


Change by Abhilash Raj :


--
pull_requests: +13968
pull_request: https://github.com/python/cpython/pull/14119

___
Python tracker 

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



[issue37294] ProcessPoolExecutor fails with super

2019-06-15 Thread Géry

Change by Géry :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue37271] Make multiple passes of the peephole optimizer until bytecode cannot be optimized further

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

>So, we sometimes get faster wordcode but that time it takes to get there is 
>longer.

Is worth noting that the (very small) overhead to obtain the wordcode happens 
once but the benefits of the resulting opcode will be felt every time you 
execute it.

--

___
Python tracker 

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



[issue37294] ProcessPoolExecutor fails with super

2019-06-15 Thread Géry

New submission from Géry :

The following code hangs forever instead of printing "called" 10 times:

from concurrent.futures import ProcessPoolExecutor

class A:
def f(self):
print("called")

class B(A):
def f(self):
executor = ProcessPoolExecutor(max_workers=2)
futures = [executor.submit(super(B, self).f)
   for _ in range(10)]

if __name__ == "__main__":
B().f()

The same code with `super(B, self)` replaced with `super()` raises the 
following error:

> TypeError: super(type, obj): obj must be an instance or subtype of type

However, replacing `ProcessPoolExecutor` with `ThreadPoolExecutor` works  as 
expected, but only with `super(B, self)` (with `super()` it still raises the 
same error).

--
components: Library (Lib)
messages: 345709
nosy: asvetlov, bquinlan, inada.naoki, lukasz.langa, maggyero, ned.deily, 
pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: ProcessPoolExecutor fails with super
type: crash
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



[issue35360] Update SQLite to 3.26 in Windows and macOS installer builds

2019-06-15 Thread Big Stone


Big Stone  added the comment:

any hope for beta2 ?

--

___
Python tracker 

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



[issue37271] Make multiple passes of the peephole optimizer until bytecode cannot be optimized further

2019-06-15 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Tim, do you have any thoughts on this?

In the past, there was an implicit red-line that we would not cross even if a 
performance improvement was possible.  Given that that was a long time ago and 
that the newer devs are both more aggressive and more fearless, we ought to 
re-examine whether the red-line should be made explicit or whether it no longer 
applies.

For this particular patch, a source of discomfort is that the optimization step 
takes longer (due to multiple passes).  So, we sometimes get faster wordcode 
but that time it takes to get there is longer.

--
nosy: +tim.peters

___
Python tracker 

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



[issue37271] Make multiple passes of the peephole optimizer until bytecode cannot be optimized further

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Probably is not that easy, but a naive thought respecting loops:

As the peephole optimizer only produces code that is the same length or smaller 
and it works by feeling noops and deleting them, the only loop would be code 
that is of the same length but different, but that cannot happen by adding 
noops and removing them, right?

--

___
Python tracker 

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



[issue37271] Make multiple passes of the peephole optimizer until bytecode cannot be optimized further

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

We can add a #define for a maximum numbers of iterations. The pyperformance 
test suite shows speed ups of 2-3% without PGO/LTO. I will ran more concise 
experiments including PGO but even with a max cap of iterations (10 in my 
experiments) we get nice improvements without much more complexity.

--

___
Python tracker 

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



[issue32912] Raise non-silent warning for invalid escape sequences

2019-06-15 Thread Mark Dickinson


Mark Dickinson  added the comment:

[Aaron]

> [...] makes it very difficult for library authors to fix this.

If you're willing to use 3rd party libraries, then my own experience is that 
`pycodestyle` or `flake8` make this easy: you just need to run "flake8 --select 
W605" at the root of your repository tree to get a list of all the code 
locations that need to be fixed.

--

___
Python tracker 

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



[issue37251] Mocking a MagicMock with a function spec results in an AsyncMock

2019-06-15 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I created PR to ensure the __code__ object is checked to be a CodeType and 
converted the report to a unittest. I also found a similar function 
_is_async_func [0] which also seems to perform similar check but is used only 
in create_autospec. creating an autospec function out of MagicMock with a 
function spec is not possible so though the change could be made it's not 
testable. Also changing _is_async_func to _is_async_obj in create_autospec 
shows no test case failure. Can this be removed to use only _is_async_obj? Is 
there a difference in their usage due to isawaitable check present in 
_is_async_obj that needs a test?

# create_autospec with MagicMock(spec=lambda x: x)

$ cpython git:(bpo37251) ./python.exe
Python 3.9.0a0 (heads/master:7a68f8c28b, Jun 15 2019, 21:00:05)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from unittest.mock import *
>>> create_autospec(MagicMock())

>>> create_autospec(MagicMock(spec=lambda x: x))
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 2547, in create_autospec
mock = Klass(parent=_parent, _new_parent=_parent, _new_name=_new_name,
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 2066, in __init__
super().__init__(*args, **kwargs)
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 1996, in __init__
_safe_super(AsyncMagicMixin, self).__init__(*args, **kw)
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 1007, in __init__
_safe_super(CallableMixin, self).__init__(
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 442, in __init__
self._mock_add_spec(spec, spec_set, _spec_as_instance, _eat_self)
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 503, in _mock_add_spec
res = _get_signature_object(spec,
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 99, in _get_signature_object
return func, inspect.signature(sig_func)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/inspect.py", 
line 3093, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/inspect.py", 
line 2842, in from_callable
return _signature_from_callable(obj, sigcls=cls,
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/inspect.py", 
line 2292, in _signature_from_callable
return _signature_from_function(sigcls, obj,
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/inspect.py", 
line 2175, in _signature_from_function
parameters.append(Parameter(name, annotation=annotation,
  File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/inspect.py", 
line 2495, in __init__
raise TypeError(msg)
TypeError: name must be a str, not a MagicMock


[0] 
https://github.com/python/cpython/blob/3a1d50e7e573efb577714146bed5c03b9c95f466/Lib/unittest/mock.py#L55

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Thomas Caswell


Thomas Caswell  added the comment:

I can confirm that master branches of cpython, cython, and numpy all build 
together again, thank you for the quick investigation and fix!

--

___
Python tracker 

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



[issue37271] Make multiple passes of the peephole optimizer until bytecode cannot be optimized further

2019-06-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

We should handle this with care and prove that the optimization loop is finite.

--

___
Python tracker 

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



[issue35647] Cookie path check returns incorrect results

2019-06-15 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Closing this as resolved since the fix was merged to all branches. Thank you 
all.

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



[issue35121] Cookie domain check returns incorrect results

2019-06-15 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Closing this as resolved since the fix was merged to all branches. Thank you 
all.

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, it could be moved to the compiler. See issue32477 which moves at that 
direction.

--

___
Python tracker 

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



[issue37251] Mocking a MagicMock with a function spec results in an AsyncMock

2019-06-15 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue35647] Cookie path check returns incorrect results

2019-06-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset ee15aa2b8501718cb77e339381f72409a416f801 by Serhiy Storchaka 
(Xtreak) in branch '2.7':
[2.7] bpo-35647: Fix path check in cookiejar. (GH-11436) (GH-13427)
https://github.com/python/cpython/commit/ee15aa2b8501718cb77e339381f72409a416f801


--

___
Python tracker 

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



[issue32477] Move jumps optimization from the peepholer to the compiler

2019-06-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue32477] Move jumps optimization from the peepholer to the compiler

2019-06-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

PR 14116 is based on the part of PR 5077. It serves three functions:

* Finally fixes issue1875.

* Simplifies the code. Removes special cases for "if 0" and "while 1". 31 
insertions, 80 deletions in Python/compile.c + Python/peephole.c.

* However such optimization is now applied in more general cases, not just for 
"if" and "while".

--

___
Python tracker 

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



[issue28009] core logic of uuid.getnode() needs refresh

2019-06-15 Thread miss-islington


miss-islington  added the comment:


New changeset f0e5c01182daefa20c624383c8a37c25eacfde43 by Miss Islington (bot) 
in branch '3.8':
bpo-28009: Fix uuid SkipUnless logic to be based on platform programs capable 
of introspection (GH-12777)
https://github.com/python/cpython/commit/f0e5c01182daefa20c624383c8a37c25eacfde43


--
nosy: +miss-islington

___
Python tracker 

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



[issue1875] "if 0: return" not raising SyntaxError

2019-06-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue32477] Move jumps optimization from the peepholer to the compiler

2019-06-15 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +13966
pull_request: https://github.com/python/cpython/pull/14116

___
Python tracker 

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



[issue36785] Implement PEP 574

2019-06-15 Thread miss-islington


miss-islington  added the comment:


New changeset 298023633fde5cd60926a2923a01d896550cbf84 by Miss Islington (bot) 
in branch '3.8':
bpo-36785: PEP 574 What's New entry (GH-13931)
https://github.com/python/cpython/commit/298023633fde5cd60926a2923a01d896550cbf84


--
nosy: +miss-islington

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Would it make sense to put this on the compiler? When we run compile_if we 
could check if there is one constant in the test and of the constant is true we 
skip the block.

--

___
Python tracker 

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



[issue28009] core logic of uuid.getnode() needs refresh

2019-06-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +13964
pull_request: https://github.com/python/cpython/pull/14115

___
Python tracker 

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



[issue28009] core logic of uuid.getnode() needs refresh

2019-06-15 Thread Nick Coghlan


Nick Coghlan  added the comment:


New changeset 3a1d50e7e573efb577714146bed5c03b9c95f466 by Nick Coghlan (Michael 
Felt) in branch 'master':
bpo-28009: Fix uuid SkipUnless logic to be based on platform programs capable 
of introspection (GH-12777)
https://github.com/python/cpython/commit/3a1d50e7e573efb577714146bed5c03b9c95f466


--
nosy: +ncoghlan

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Sure, will do.

How you think we should handle this particular optimization? Do you see a more 
resilient way of doing this on the peephole optimizer?

--

___
Python tracker 

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



[issue1572968] release GIL while doing I/O operations in the mmap module

2019-06-15 Thread Zackery Spytz


Change by Zackery Spytz :


--
components: +Extension Modules -Library (Lib)
nosy: +ZackerySpytz
versions: +Python 3.9 -Python 2.7, Python 3.1

___
Python tracker 

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



[issue1572968] release GIL while doing I/O operations in the mmap module

2019-06-15 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Do you mind to add a test?

--

___
Python tracker 

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



[issue35121] Cookie domain check returns incorrect results

2019-06-15 Thread miss-islington


miss-islington  added the comment:


New changeset 979daae300916adb399ab5b51410b6ebd0888f13 by Miss Islington (bot) 
(Xtreak) in branch '2.7':
[2.7] bpo-35121: prefix dot in domain for proper subdomain validation 
(GH-10258) (GH-13426)
https://github.com/python/cpython/commit/979daae300916adb399ab5b51410b6ebd0888f13


--
nosy: +miss-islington

___
Python tracker 

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



[issue36785] Implement PEP 574

2019-06-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +13962
pull_request: https://github.com/python/cpython/pull/14113

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 284daeade210d3aac049f4278a1fb76d19e6d78a by Pablo Galindo (Miss 
Islington (bot)) in branch '3.8':
bpo-37289: Remove 'if False' handling in the peephole optimizer (GH-14099) 
(GH-14112)
https://github.com/python/cpython/commit/284daeade210d3aac049f4278a1fb76d19e6d78a


--

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 81fecf7b7a6e766a213c6e670219c1da52461589 by Pablo Galindo (Miss 
Islington (bot)) in branch '3.7':
bpo-37289: Remove 'if False' handling in the peephole optimizer (GH-14099) 
(GH-14111)
https://github.com/python/cpython/commit/81fecf7b7a6e766a213c6e670219c1da52461589


--

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Just to be clear, before PR14099, the code was wrongly optimized to:

  3   0 LOAD_GLOBAL  0 (g)
  2 LOAD_ATTR1 (__code__)
  4 POP_JUMP_IF_FALSE8
  6 JUMP_FORWARD 0 (to 8)

  4 >>8 LOAD_CONST   0 (None)
 10 RETURN_VALUE

--

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Serhiy, this is the code that was incorrectly optimized:

  3   0 LOAD_GLOBAL  0 (g)
  2 LOAD_ATTR1 (__code__)
  4 POP_JUMP_IF_FALSE8
  6 JUMP_FORWARD 4 (to 12)
>>8 LOAD_CONST   0 (None)
 10 POP_JUMP_IF_FALSE   20

  4 >>   12 LOAD_GLOBAL  2 (print)
 14 LOAD_CONST   2 ('Called!')
 16 CALL_FUNCTION1
 18 POP_TOP
>>   20 LOAD_CONST   0 (None)
 22 RETURN_VALUE

def g():
if True if g.__code__ else None:
print("Called!")

g()

The problem is that [LOAD_CONST   0 (None)] made the peephole to 
delete the block because it does not detect that previous conditions in the 
same conditional could be True. The general case was made by looking back for 
POP_JUMP_IF_{FALSE,TRUE} but with this construct JUMP_FORWARD appears.

I think handling this condition in the peephole optimizer can be very dangerous 
error prone to get right because all the information is lost, but doing it at 
the ast level makes us lose syntax errors in optimized blocks, which is also 
wrong. Any ideas?

It happens here in Cython:

https://github.com/cython/cython/blob/master/Cython/Compiler/Nodes.py#L5131

That's why the errors manifest as pickling errors

--

___
Python tracker 

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



[issue1875] "if 0: return" not raising SyntaxError

2019-06-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The issue is not fixed yet. The compiler now rejects

if 0:
return

but it still accepts

if 1:
pass
else:
return

while 0:
return

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

___
Python tracker 

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



[issue35998] test_asyncio: test_start_tls_server_1() TimeoutError on Fedora 29

2019-06-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Ooops. Looks like a real problem, not test-only :(

--

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +13961
pull_request: https://github.com/python/cpython/pull/14112

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +13960
pull_request: https://github.com/python/cpython/pull/14111

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 7a68f8c28bb78d957555a5001dac4df6345434a0 by Pablo Galindo in 
branch 'master':
bpo-37289: Remove 'if False' handling in the peephole optimizer (GH-14099)
https://github.com/python/cpython/commit/7a68f8c28bb78d957555a5001dac4df6345434a0


--

___
Python tracker 

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



[issue37293] concurrent.futures.InterpreterPoolExecutor

2019-06-15 Thread Crusader Ky


New submission from Crusader Ky :

As one of the logical consequences to PEP 554, it would be neat to have a 
concurrent.futures.InterpreterPoolExecutor.

I wrote the initial code at https://github.com/crusaderky/subinterpreters_tests 
- currently missing unit tests and pickle5 buffers support.

If everybody is happy with the design, I'll start working on a PR as soon as 
the GIL becomes per-interpreter (it's kinda pointless before that).

--
components: Extension Modules
messages: 345681
nosy: Crusader Ky, eric.snow
priority: normal
severity: normal
status: open
title: concurrent.futures.InterpreterPoolExecutor
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



[issue37292] _xxsubinterpreters: Can't unpickle objects defined in __main__

2019-06-15 Thread Crusader Ky


New submission from Crusader Ky :

As of CPython 3.8.0b1:

If one pickles an object that is defined in the __main__ module, sends it to a 
subinterpreter as bytes, and then tries unpickling it there, it fails saying 
that __main__ doesn't define it.


import _xxsubinterpreters as interpreters
import pickle


class C:
pass


c = C()

interp_id = interpreters.create()
c_bytes = pickle.dumps(c)
interpreters.run_string(
interp_id,
"import pickle; pickle.loads(c_bytes)",
shared={"c_bytes": c_bytes},
)


If the above is executed directly with the python command-line, it fails. If 
it's imported from another module, it works.
One would expected behaviour compatible with sub-processes spawned with the 
spawn method, where the__main__ of the parent process is visible to the 
subprocess too.

Workarounds:
1 - define everything that must be pickled in an imported module
2 - use CloudPickle

--
messages: 345680
nosy: Crusader Ky, eric.snow
priority: normal
severity: normal
status: open
title: _xxsubinterpreters: Can't unpickle objects defined in __main__
type: behavior
versions: Python 3.9

___
Python tracker 

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



[issue37292] _xxsubinterpreters: Can't unpickle objects defined in __main__

2019-06-15 Thread Crusader Ky


Change by Crusader Ky :


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



[issue37248] support conversion of `func(**{} if a else b)`

2019-06-15 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the report. Closing.

--
stage:  -> resolved
status: open -> closed
superseder:  -> Make lib2to3 grammar more closely match Python

___
Python tracker 

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



[issue37248] support conversion of `func(**{} if a else b)`

2019-06-15 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
resolution:  -> duplicate

___
Python tracker 

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



[issue37248] support conversion of `func(**{} if a else b)`

2019-06-15 Thread Shen Han


Shen Han  added the comment:

Yes, I think so.

--

___
Python tracker 

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



[issue37291] AST - code cleanup

2019-06-15 Thread SilentGhost


Change by SilentGhost :


--
components: +Interpreter Core
nosy: +benjamin.peterson
type:  -> behavior

___
Python tracker 

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



[issue37279] asyncio sendfile sends extra data in the last chunk in fallback mode

2019-06-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset e5d67f1e31381d28b24f6e1c0f8388d9bf0bfc5f by Andrew Svetlov in 
branch '3.7':
[3.7] bpo-37279: Fix asyncio sendfile support when  extra data are sent in 
fallback mode. (GH-14075). (GH-14103)
https://github.com/python/cpython/commit/e5d67f1e31381d28b24f6e1c0f8388d9bf0bfc5f


--

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I was not able to find it in Cython but PR14099 fixes it so I prefer to revert 
the optimization for now and then try to add it back once we understand what's 
failing exactly.

--

___
Python tracker 

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



[issue32912] Raise non-silent warning for invalid escape sequences

2019-06-15 Thread Mark Dickinson


Mark Dickinson  added the comment:

[Raymond]

> Also, it gets in the way of the end-user strategy of "backslash anything that 
> looks special"

That's not a good strategy in the first place, though: adding an extra 
backslash for something that doesn't need to be escaped isn't benign - it's 
usually an error, since it puts that backslash into the resulting string.

>>> "abc\`d" == "abc`d"
False

In other words, it seems to me that getting in the way of this broken end-user 
strategy is a *good* thing, since it warns of possible mistakes.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue37291] AST - code cleanup

2019-06-15 Thread David Carlier


New submission from David Carlier :

Removing little dead code part.

--
messages: 345674
nosy: David Carlier
priority: normal
pull_requests: 13959
severity: normal
status: open
title: AST - code cleanup
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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Could you please provide an example of the improperly optimized code?

--

___
Python tracker 

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



[issue37280] Use threadpool for reading from file for sendfile fallback mode

2019-06-15 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue37279] asyncio sendfile sends extra data in the last chunk in fallback mode

2019-06-15 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue37279] asyncio sendfile sends extra data in the last chunk in fallback mode

2019-06-15 Thread miss-islington


miss-islington  added the comment:


New changeset bb07321c6a7e1cbe597c3fc5fa275a85d0f50acb by Miss Islington (bot) 
in branch '3.8':
bpo-37279: Fix asyncio sendfile support when  extra data are sent in fallback 
mode. (GH-14075)
https://github.com/python/cpython/commit/bb07321c6a7e1cbe597c3fc5fa275a85d0f50acb


--
nosy: +miss-islington

___
Python tracker 

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



[issue37280] Use threadpool for reading from file for sendfile fallback mode

2019-06-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +13958
pull_request: https://github.com/python/cpython/pull/14101

___
Python tracker 

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



[issue37279] asyncio sendfile sends extra data in the last chunk in fallback mode

2019-06-15 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
pull_requests: +13957
pull_request: https://github.com/python/cpython/pull/14103

___
Python tracker 

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



[issue37280] Use threadpool for reading from file for sendfile fallback mode

2019-06-15 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
pull_requests: +13956
pull_request: https://github.com/python/cpython/pull/14102

___
Python tracker 

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



[issue37279] asyncio sendfile sends extra data in the last chunk in fallback mode

2019-06-15 Thread Andrew Svetlov


Andrew Svetlov  added the comment:


New changeset ef2152354f03a165c5e3adb53e2276934fabd50a by Andrew Svetlov in 
branch 'master':
bpo-37279: Fix asyncio sendfile support when  extra data are sent in fallback 
mode. (GH-14075)
https://github.com/python/cpython/commit/ef2152354f03a165c5e3adb53e2276934fabd50a


--

___
Python tracker 

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



[issue37279] asyncio sendfile sends extra data in the last chunk in fallback mode

2019-06-15 Thread miss-islington


Change by miss-islington :


--
pull_requests: +13955
pull_request: https://github.com/python/cpython/pull/14100

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I managed to find the original cause, although I don't understand exactly why 
it happens. The error is caused by the 'if False' handling of 
https://github.com/python/cpython/pull/13332. There is some failure in that 
logic, so for now I made a PR reverting that change.

--

___
Python tracker 

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



[issue37290] Mistranslation (Japanese)

2019-06-15 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> third party
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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

[I have deleted some comments claiming that I was not able to reproduce the 
issue because I managed to reproduce the issue correctly at the end]

--

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

I have compiled CPython master, install the current Cython on pypi (not Cython 
master) and tried to compile numpy and it succeeds. This seems that is 
something on Cython master.

~/github/numpy master ✔
 ~/github/cpython/python.exe --version
Python 3.9.0a0

~/github/numpy master ✔
❯ ~/github/cpython/python.exe -m pip freeze
/Users/pgalindo3/.local/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/_base.py:3:
 DeprecationWarning: Using or importing the ABCs from 'collections' instead of 
from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop 
working
  from collections import Mapping
Cython==0.29.10

❯ ~/github/cpython/python.exe -m pip install . --user
/Users/pgalindo3/.local/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/_base.py:3:
 DeprecationWarning: Using or importing the ABCs from 'collections' instead of 
from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop 
working
  from collections import Mapping
Processing /Users/pgalindo3/github/numpy
Installing collected packages: numpy
  Running setup.py install for numpy ... done
Successfully installed numpy-1.17.0.dev0+9f8401f

--

___
Python tracker 

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



[issue36707] The "m" ABI flag of SOABI for pymalloc is no longer needed

2019-06-15 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks everybody for your help. It is now documented.

--

___
Python tracker 

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



[issue36707] The "m" ABI flag of SOABI for pymalloc is no longer needed

2019-06-15 Thread STINNER Victor


STINNER Victor  added the comment:

Ned Deily:
> My preference remains to not make the flags change at all

Well, "m" in ABI flags became useless around Python 3.4. I don't see the point 
of pretending that the "m" ABI is different and then provide two names for the 
same thing:

python3.8 and python3.8m
python3.8-config and python3.8m-config
man python3.8 and man python3.8m
etc.

I'm not sure why, but on Fedora /usr/bin/python3.7 and /usr/bin/python3.7m are 
two separated files... with the same content (ex: same MD5 sum). Well, it's 
just 17 KiB each :-) /usr/bin/python3.7-config is a symlink to 
python3.7m-config.

The change itself is painful for distributors like Red Hat (Fedora, RHEL), but 
things should be simpler once the change is done.

My long-term goal is to get a single ABI for everything: CPython, PyPy, 
RustPython, MicroPython, etc. :-) Maybe it's not possible, but at least I would 
like to move towards this goal!

Overall project:

* 
https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
* https://pythoncapi.readthedocs.io/

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

I tried to compile numpy with python3.8 alpha 4 and Cython master and still 
fails:

~/github/numpy master ✔
❯ ~/github/cpython/python.exe --version
Python 3.8.0a4

~/github/numpy master ✔
❯ ~/github/cpython/python.exe -m pip freeze
/Users/pgalindo3/.local/lib/python3.8/site-packages/pip/_vendor/html5lib/_trie/_base.py:3:
 DeprecationWarning: Using or importing the ABCs from 'collections' instead of 
from 'collections.abc' is deprecated, and in 3.8 it will stop working
  from collections import Mapping
Cython==3.0a0


~/github/numpy master ✔
❯ ~/github/cpython/python.exe -m pip install . --user
   generate_cython()
  File 
"/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-req-build-vposbe_c/setup.py",
 line 234, in generate_cython
raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!


Command "/Users/pgalindo3/github/cpython/python.exe -u -c "import setuptools, 
tokenize;__file__='/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-req-build-vposbe_c/setup.py';f=getattr(tokenize,
 'open', open)(__file__);code=f.read().replace('\r\n', 
'\n');f.close();exec(compile(code, __file__, 'exec'))" install --record 
/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-record-9l43u38y/install-record.txt
 --single-version-externally-managed --compile --user --prefix=" failed with 
error code 1 in 
/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-req-build-vposbe_c/

--

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Did you open a bug in the Cython tracker?

--

___
Python tracker 

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



[issue37289] regression in Cython when pickling objects

2019-06-15 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
title: regression in cython due to peephole optomization -> regression in 
Cython when pickling objects

___
Python tracker 

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



[issue37289] regression in cython due to peephole optomization

2019-06-15 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

I reverted 3498c642f4e83f3d8e2214654c0fa8e0d51cebe5 and tried to build cython 
and numpy an it fails for me still:

> git log

commit 17e024a1a999f96fee52e99bd4587da383647993 (HEAD -> master)
Author: Pablo Galindo 
Date:   Sat Jun 15 10:16:52 2019 +0100

revert "bpo-37213: Handle negative line deltas correctly in the peephole 
optimizer (GH-13969)"

This reverts commit 3498c642f4e83f3d8e2214654c0fa8e0d51cebe5.

commit 7efc526e5cfb929a79c192ac2dcf7eb78d3a4401 (upstream/master, upstream/HEAD)
Author: Victor Stinner 
Date:   Sat Jun 15 03:24:41 2019 +0200

bpo-36707: Document "m" removal from sys.abiflags (GH-14090)


❯ ~/github/cpython/python.exe -m pip install . --user
/Users/pgalindo3/.local/lib/python3.9/site-packages/pip/_vendor/html5lib/_trie/_base.py:3:
 DeprecationWarning: Using or importing the ABCs from 'collections' instead of 
from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop 
working
  from collections import Mapping
Looking in indexes: http://localhost:3141/pablogsal/local/+simple/
Processing /Users/pgalindo3/github/cython
Installing collected packages: Cython
  Running setup.py install for Cython ... done
Successfully installed Cython-3.0a0

❯ ~/github/cpython/python.exe -m pip install . --user
Processing numpy/random/dsfmt.pyx
Traceback (most recent call last):
  File 
"/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-req-build-1nbv5hs2/tools/cythonize.py",
 line 243, in 
main()
  File 
"/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-req-build-1nbv5hs2/tools/cythonize.py",
 line 239, in main
find_process_files(root_dir)
  File 
"/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-req-build-1nbv5hs2/tools/cythonize.py",
 line 230, in find_process_files
process(root_dir, fromfile, tofile, function, hash_db)
  File 
"/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-req-build-1nbv5hs2/tools/cythonize.py",
 line 196, in process
processor_function(fromfile, tofile)
  File 
"/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-req-build-1nbv5hs2/tools/cythonize.py",
 line 85, in process_pyx
subprocess.check_call(
  File "/Users/pgalindo3/github/cpython/Lib/subprocess.py", line 348, in 
check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 
'['/Users/pgalindo3/github/cpython/python.exe', '-m', 'cython', '-3', 
'--fast-fail', '-o', 'dsfmt.c', 'dsfmt.pyx']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-req-build-1nbv5hs2/setup.py",
 line 443, in 
setup_package()
  File 
"/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-req-build-1nbv5hs2/setup.py",
 line 426, in setup_package
generate_cython()
  File 
"/private/var/folders/sw/ml9tlhsx7hd7sdqpnlzhrxxhgr/T/pip-req-build-1nbv5hs2/setup.py",
 line 234, in generate_cython
raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!

--

___
Python tracker 

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



  1   2   >