[issue38905] venv python reports wrong sys.executable in a subprocess on Windows

2020-04-18 Thread Benedek Rácz

Benedek Rácz  added the comment:

Is there any update/solution for this issue? This issue is the root cause of 
this SO post: https://stackoverflow.com/q/61290972/2506522

--
nosy: +Benedek Rácz

___
Python tracker 

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



[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-18 Thread Allan Feldman


Allan Feldman  added the comment:

Reading more carefully, I may have jumped to conclusions here :)

Looking at the weakref docs, I see the following description of the callback 
functionality:

> If callback is provided and not None, and the returned weakref object is 
> still alive, the callback will be called when the object is about to be 
> finalized; the weak reference object will be passed as the only parameter to 
> the callback; the referent will no longer be available.

This description seems to imply that even if an object is resurrected, the 
callback will be run.

Using the `ForeverObject` example above, I see the weakref callback behavior is 
different when going through gc versus going through `_Py_Dealloc`.

The behavior being different seems to imply that a contract is broken somewhere.

In this case I think I assumed it was gc, but it looks like it might actually 
be that the contract (as currently defined) is broken by dealloc. Finalizers 
are always called before weakref callbacks on the reference counted path:
https://github.com/python/cpython/blob/482259d0dcf27714a84cf56b93977320bea7e093/Objects/typeobject.c#L1245

Here is the output from the `ForeverObject` example above:

--- Circular reference: True ---
callback running 
--
--- Circular reference: False ---
--

For my own understanding, why is the API documented as running the callback 
prior to finalizers running? The referent is unavailable when the callback 
runs, so isn't it safe to run the weakref callbacks consistently after the 
finalizers?

--

___
Python tracker 

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



[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-18 Thread Tim Peters


Tim Peters  added the comment:

Ah, I missed that `cache` is global.  So it will hold reachable strong refs to 
the weakrefs stored for the dict's values.  So gc will run the callbacks 
associated with weakrefs' trash referents.

I think you're out of luck.  Nothing is defined about the order in which the 
stuff in cyclic trash is destroyed.  gc has no knowledge of your intended 
semantics, and no way to be taught.  You happened to create code that assumed 
(albeit indirectly & subtly) a finalizer would run before a relevant callback, 
but someone else could create code assuming the reverse.

It so happens that gc forces all callbacks to run before it forces any 
finalizers to run, and I'm loathe to change that code - weakref callbacks in 
particular have been an historical segfault factory, so nobody will touch that 
code without extraordinarily strong reason to risk it.  But I'll add Pablo here 
just in case he's feeling adventurous ;-)

In any case, I'd say it's always _best_ practice to never delete a key from any 
kind of weak dict except under protection of a try/except block.  The point of 
a weak dict is that entries can vanish "by magic".  And in this particular 
case, by deeper magic than was anticipated ;-)

--
nosy: +pablogsal

___
Python tracker 

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



[issue40308] Intermittent failure of test_os.TestScandir.test_attributes on Windows

2020-04-18 Thread Dennis Sweeney


Change by Dennis Sweeney :


--
resolution:  -> works for me
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



[issue40078] asyncio subprocesses allow pids to be reaped, different behavior than regular subprocesses

2020-04-18 Thread Carl Lewin


Carl Lewin  added the comment:

Very first time engaging in such a forum. Apologies is advance if I am doing it 
wrong!

Observation: ps -ef shows "Defunct" process until calling script terminates

Scenario: equivalent test scripts in BASH, Python 2.7 and 3.6 that:
1. Start a ping
2. SIGTERM (kill -15) the associated PID 
3. wait for a user input (hence stopping the script terminating)

I tried P.Open and threading but behaviour is same.

BASH script does not show any "defunct" process.

Is this "Child Reaping" the cause of this observed behaviour?

Problem comes when the Parent script is required to run constantly (server type 
scenario) as the "defunct" processes will presumably eventually consume all 
system resources?

--
nosy: +c-lewin

___
Python tracker 

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



[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-04-18 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-18 Thread Allan Feldman


Allan Feldman  added the comment:

Thanks for the response!

> if a weakref W refers to object O, and W and O are _both_ in cyclic trash

I believe that in the examples W is not in cyclic trash, but remains referenced 
as a global in the frame. Only O is in cyclic trash (O references itself).

I would expect that W's callback would be invoked in this case, but only after 
O is guaranteed to be deleted. In some cases O can be resurrected in the 
finalizer.

--

___
Python tracker 

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



[issue40312] Weakref callbacks running before finalizers in GC collection

2020-04-18 Thread Tim Peters


Tim Peters  added the comment:

Offhand I'm surprised because of this:  if a weakref W refers to object O, and 
W and O are _both_ in cyclic trash, gc does not want to invoke W's callback (if 
any).  In fact, it works hard not to call it.  So I'm surprised that the 
callback is invoked at all, not by whether it's called before or after __del__ 
is called.

--
nosy: +tim.peters

___
Python tracker 

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



[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-04-18 Thread Tim Peters


Tim Peters  added the comment:

Yup, I agree sample(set) is a misfeature.

--

___
Python tracker 

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



[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-04-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I think the thing we can fix is the automatic set support which is 
intrinsically broken with respect to reproducibility and which was likely not a 
good idea to begin with (because it adds an implicit and possibly unexpected 
O(n) conversion step and because it doesn't make the API for choice()).

If someone converts a set to a list or tuple upstream from sample(), there 
isn't much we can do about it.   That wouldn't be much different from 
list(s)[0] giving different output from run to run.  That is a general FAQ and 
would apply to just about anything that takes a sequence or iterator to run.

--

___
Python tracker 

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



[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-04-18 Thread Tim Peters


Tim Peters  added the comment:

Raymond, I think that removing sample(set) support is a different issue.  This 
report will just change its final example line to

>>> print(random.sample(list(x), 1))

or

>>> print(random.sample(tuple(x), 1))

and have the same complaint.

--
nosy: +tim.peters

___
Python tracker 

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



[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-04-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm going to deprecate the support for sets.  It was a design mistake at 
several levels.  Better to just remove it.

--
assignee: docs@python -> rhettinger
nosy: +rhettinger
type:  -> behavior
versions: +Python 3.9 -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



[issue40324] python 3.8.2 idle not opening

2020-04-18 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Please answer the questions in msg365164 of #40083.

--

___
Python tracker 

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



[issue40255] Fixing Copy on Writes from reference counting

2020-04-18 Thread Neil Schemenauer


Neil Schemenauer  added the comment:

I resurrected an old thread on Discourse that seems quite relevant to this PR:

https://discuss.python.org/t/switching-from-refcounting-to-libgc/1641/35?u=nas

--

___
Python tracker 

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



[issue40311] docs.python.org banner - release blocker for 2.7.18

2020-04-18 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

0fc82e95878234291f23155a64408fced71892b2

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



[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-04-18 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

String hash randomization is a security feature so it may be better to not 
disable it unless explicitly asked for. Maybe a note in random's documentation 
could be added?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue40325] Random.seed does not affect string hash randomization leading to non-intuitive results

2020-04-18 Thread Yuval S


New submission from Yuval S :

The following code gives different results on each run, even though 
"``random.seed()``" is used:

>>> import random
>>> random.seed(6)
>>> x = set(str(i) for i in range(500))
>>> print(random.sample(x, 1))

presumably because of string hash randomization (see also #27706),
unless "``PYTHONHASHSEED``" is set. 

However, this is non-intuitive, especially as this random aspect of Python is 
not mentioned in `Notes on Reproducability 
`_.

I would suggest this is either fixed (using the provided seed for string hash 
randomization as well) or documented.

--
assignee: docs@python
components: Documentation, Library (Lib)
files: test.py
messages: 366741
nosy: Yuval S, docs@python
priority: normal
severity: normal
status: open
title: Random.seed does not affect string hash randomization leading to 
non-intuitive results
versions: Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49075/test.py

___
Python tracker 

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



[issue40247] Logged out of user when running Tkinter

2020-04-18 Thread Ned Deily

Ned Deily  added the comment:

Thanks for the additional info but it still leaves open questions.  The current 
versions of python.org installers for macOS (3.8.2 and 3.7.7) and various 
others over the past couple of years all come with a built-in version of Tk 8.6 
and that normally cannot be overriden. So if you are seeing indications that Tk 
8.5.x is in use, you are somehow not really using those current versions of 
python.org installers or you are calling out within them directly to an older 
version of Tk (via a subprocess call, for example).  The Apple-provided Tk 
8.5.x on macOS systems is woefully out-of-date and has known critical bugs, 
like crashing when typing in composite characters (like option-u then U to 
produce Ü on an English keyboard).  Anyway, since you have solved the issue for 
you, I am going to close this issue.

--
resolution:  -> works for me
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



[issue40323] Printing of Single (') and Double (") code in one sentence using escape Code

2020-04-18 Thread SilentGhost


SilentGhost  added the comment:

The output in REPL is valid representation of an object that can be often be 
used to re-create the object, you could use print function to see how the 
string would look like when output on screen or written into a file.

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



[issue40321] urllib.request does not support HTTP response status code 308

2020-04-18 Thread Ned Deily


Change by Ned Deily :


--
nosy: +orsenthil

___
Python tracker 

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



[issue23414] seek(count, whence) accepts bogus whence on windows, python2.7

2020-04-18 Thread Ned Deily


Change by Ned Deily :


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



[issue40324] python 3.8.2 idle not opening

2020-04-18 Thread krishan danushka


New submission from krishan danushka :

i downloaded python 3.8.2 version.but idle is not opening.i trying serveral 
time by reinstall but it doesn't working.

--
assignee: terry.reedy
components: IDLE
messages: 366738
nosy: krishandanushka...@gmail.com, terry.reedy
priority: normal
severity: normal
status: open
title: python 3.8.2 idle not opening
type: performance
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



[issue40322] struct.pack adding unexpected byte in 'B' format

2020-04-18 Thread Robert Bressan


Robert Bressan  added the comment:

After placing a standard size instead of a native one, solved.

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



[issue40323] Printing of Single (') and Double (") code in one sentence using escape Code

2020-04-18 Thread Vishnuvenkatesh Dhage


New submission from Vishnuvenkatesh Dhage :

In Python shell v3.8.2,

when user want to use both single quotation mark and double quotation mark in 
one sentence/paragraph then Single Quotation is displayed in the screen along 
with escape code i.e. \', but double quotation display ok i.e. ".

example:
>>>'\"Python\" programming language is very easy. It\'s used for developing 
>>>rapid application development.'



The result is printed is as below
>>>'"Python" programming language is very easy. It\'s used for developing rapid 
>>>application development.'

In my view, after pressing enter the output should be 
>>>'"Python" programming language is very easy. It's used for developing rapid 
>>>application development.'
 
Please look into my observation.
Thanks with regards
Vishnuvenkatesh Dhage
encls: Python v3.8.2 Shell screenshot along with example

--
components: IO
files: Single and Double Quotatin using escape code.jpg
messages: 366736
nosy: benjamin.peterson, vmdhage
priority: normal
severity: normal
status: open
title: Printing of Single (') and Double (") code in one sentence using escape 
Code
type: behavior
versions: Python 3.8
Added file: https://bugs.python.org/file49074/Single and Double Quotatin using 
escape code.jpg

___
Python tracker 

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



[issue23414] seek(count, whence) accepts bogus whence on windows, python2.7

2020-04-18 Thread Zackery Spytz


Zackery Spytz  added the comment:

Python 2 is EOL.

--
nosy: +ZackerySpytz

___
Python tracker 

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



[issue40322] struct.pack adding unexpected byte in 'B' format

2020-04-18 Thread Robert Bressan

New submission from Robert Bressan :

struct.pack() is adding an unexpected null byte.

When I've run this code:
___
import struct
d = {'c':b'a', 'b':1, 'B':1, '?':False, 'h':2, 'H':2, 'i':-3, 'I':3, 'l':4, 
'L':4, 'q':5, 'Q':5, 'f':100.0, 'd':2.0}

for x in d:
y = struct.pack(x,d[x])
print('len('+x+') = ' + str(len(y)) + ': ' + str(y))

x = struct.pack('fBHL', 100, 1, 2,4)
print('len(fBHL) = ' + str(len(x)) + ': ' +  str(x))
¯¯¯

I got this return:
___
len(c) = 1: b'a'
len(b) = 1: b'\x01'
len(B) = 1: b'\x01'
len(?) = 1: b'\x00'
len(h) = 2: b'\x02\x00'
len(H) = 2: b'\x02\x00'
len(i) = 4: b'\xfd\xff\xff\xff'
len(I) = 4: b'\x03\x00\x00\x00'
len(l) = 4: b'\x04\x00\x00\x00'
len(L) = 4: b'\x04\x00\x00\x00'
len(q) = 8: b'\x05\x00\x00\x00\x00\x00\x00\x00'
len(Q) = 8: b'\x05\x00\x00\x00\x00\x00\x00\x00'
len(f) = 4: b'\x00\x00\xc8B'
len(d) = 8: b'\x00\x00\x00\x00\x00\x00\x00@'
len(fBHL) = 12: b'\x00\x00\xc8B\x01\x00\x02\x00\x04\x00\x00\x00'
¯¯¯
I believe the last line pack ("fBHL") consumes 11 bytes (4+1+2+4), and 
analysing the bytearray, the B is packing 2 bytes, instead of one. My expected 
result was:
___
len(fBHL) = 11: b'\x00\x00\xc8B\x01\x02\x00\x04\x00\x00\x00'
¯¯¯

--
components: Interpreter Core
messages: 366734
nosy: Robert Bressan
priority: normal
severity: normal
status: open
title: struct.pack adding unexpected byte in 'B' format
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



[issue38891] ShareableList read and write access is O(N), should be O(1)

2020-04-18 Thread Antoine Pitrou


Change by Antoine Pitrou :


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



[issue40269] Inconsistent complex behavior with (-1j)

2020-04-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Since integers don't have signed zeros, the use of integers in the complex repr 
is a little weird:

>>> (-0-1j) # The unary minus in the repr has no effect.
-1j
>>> (0-1j)
-1j

--

___
Python tracker 

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



[issue40321] urllib.request does not support HTTP response status code 308

2020-04-18 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue35113] inspect.getsource returns incorrect source for classes when class definition is part of multiline strings

2020-04-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +18924
pull_request: https://github.com/python/cpython/pull/19587

___
Python tracker 

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



[issue27635] pickle documentation says that unpickling may not call __new__

2020-04-18 Thread miss-islington


miss-islington  added the comment:


New changeset 020f2aaaea95aef6f54ab31488926ed76017e41a by Miss Islington (bot) 
in branch '3.8':
bpo-27635: Fix pickle documentation about `__new__` not being called. (GH-19269)
https://github.com/python/cpython/commit/020f2aaaea95aef6f54ab31488926ed76017e41a


--

___
Python tracker 

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



[issue27635] pickle documentation says that unpickling may not call __new__

2020-04-18 Thread miss-islington


miss-islington  added the comment:


New changeset 0abb548cc7b239fbe426ca9e00968130e53ffc98 by Miss Islington (bot) 
in branch '3.7':
bpo-27635: Fix pickle documentation about `__new__` not being called. (GH-19269)
https://github.com/python/cpython/commit/0abb548cc7b239fbe426ca9e00968130e53ffc98


--

___
Python tracker 

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



[issue27635] pickle documentation says that unpickling may not call __new__

2020-04-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18923
pull_request: https://github.com/python/cpython/pull/19586

___
Python tracker 

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



[issue27635] pickle documentation says that unpickling may not call __new__

2020-04-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +18922
pull_request: https://github.com/python/cpython/pull/19585

___
Python tracker 

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



[issue27635] pickle documentation says that unpickling may not call __new__

2020-04-18 Thread miss-islington

miss-islington  added the comment:


New changeset 482259d0dcf27714a84cf56b93977320bea7e093 by Furkan Önder in 
branch 'master':
bpo-27635: Fix pickle documentation about `__new__` not being called. (GH-19269)
https://github.com/python/cpython/commit/482259d0dcf27714a84cf56b93977320bea7e093


--
nosy: +miss-islington

___
Python tracker 

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



[issue40321] urllib.request does not support HTTP response status code 308

2020-04-18 Thread Jochem Schulenklopper


New submission from Jochem Schulenklopper :

urllib.request does not yet support HTTP response status code 308, as defined 
in IETF RFC 7538, https://tools.ietf.org/html/rfc7538.

308 (permanent redirect) is the 307-variant (temporary redirect) of 301 (moved 
permanently).

--
components: Library (Lib)
messages: 366729
nosy: Jochem Schulenklopper
priority: normal
severity: normal
status: open
title: urllib.request does not support HTTP response status code 308
type: behavior
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



[issue40317] inspect.getsource() examines incorrect target

2020-04-18 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Fixed in master now with 
https://github.com/python/cpython/commit/696136b993e11b37c4f34d729a0375e5ad544ade
 . This includes the change of show decorators for classes too to make it 
consistent with functions so it's not backported.

--

___
Python tracker 

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



[issue15856] inspect.getsource(SomeClass) doesn't show @decorators

2020-04-18 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:


New changeset 696136b993e11b37c4f34d729a0375e5ad544ade by Karthikeyan 
Singaravelan in branch 'master':
bpo-35113: Fix inspect.getsource to return correct source for inner classes 
(#10307)
https://github.com/python/cpython/commit/696136b993e11b37c4f34d729a0375e5ad544ade


--

___
Python tracker 

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



[issue35113] inspect.getsource returns incorrect source for classes when class definition is part of multiline strings

2020-04-18 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:


New changeset 696136b993e11b37c4f34d729a0375e5ad544ade by Karthikeyan 
Singaravelan in branch 'master':
bpo-35113: Fix inspect.getsource to return correct source for inner classes 
(#10307)
https://github.com/python/cpython/commit/696136b993e11b37c4f34d729a0375e5ad544ade


--

___
Python tracker 

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



[issue40178] Convert the remaining os funtions to Argument Clinic

2020-04-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 2b5603140c09766a7d4e8243a70d7144f684f6f9 by Serhiy Storchaka in 
branch 'master':
bpo-40178: Convert the remaining os functions to Argument Clinic. (GH-19360)
https://github.com/python/cpython/commit/2b5603140c09766a7d4e8243a70d7144f684f6f9


--

___
Python tracker 

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



[issue40179] Argument Clinic incorretly translates #elif

2020-04-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue40179] Argument Clinic incorretly translates #elif

2020-04-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset bfda4db0d2c05eef4e4ae90d899d0b67cb2e33e5 by Serhiy Storchaka in 
branch '3.8':
[3.8] bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364) 
(GH-19583)
https://github.com/python/cpython/commit/bfda4db0d2c05eef4e4ae90d899d0b67cb2e33e5


--

___
Python tracker 

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



[issue40179] Argument Clinic incorretly translates #elif

2020-04-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 67ae454da749a7ca67115b43205d9fe98bea3213 by Serhiy Storchaka in 
branch '3.7':
[3.7] bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364) 
(GH-19584)
https://github.com/python/cpython/commit/67ae454da749a7ca67115b43205d9fe98bea3213


--

___
Python tracker 

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



[issue40320] Add ability to specify instance of contextvars context to Task() & asyncio.create_task()

2020-04-18 Thread Jeff Laughlin


New submission from Jeff Laughlin :

As a test engineer I want to be able to run async test fixtures and test cases 
in different async tasks with the same Context. Not a copy; the same specific 
instance of contextvars.Context().

I do NOT want the task to run in a COPY of the context because I want mutations 
to the context to be preserved so that I can pass the mutated context into 
another async task.

I do NOT want the task to inherit the potentially polluted global context.

class Task currently unconditionally copies the current global context and has 
no facility for the user to override the context.

Therefor I propose adding a context argument to the Task constructor and to 
create_task()

It should be noted that this argument should not be used for "normal" 
development and only for "weird" stuff like test frameworks.

I should also note that Context().run() is not useful here because it is not 
async and there is no obvious existing async equivalent. This proposal would be 
roughly equivalent.

I should also note that a hack like copying the items from one context to 
another will not work because it breaks ContextVar set/reset. I tried this. It 
was a heroic failure. It must be possible to run a task with an exist instance 
of context and not a copy.

Here is a real-world use case: 
https://github.com/pytest-dev/pytest-asyncio/pull/153/files

Here is the hacked Task constructor I cooked up:

class Task(asyncio.tasks._PyTask):
def __init__(self, coro, *, loop=None, name=None, context=None):
...
self._context = context if context is not None else copy_context()

self._loop.call_soon(self.__step, context=self._context)
asyncio._register_task(self) 


if folks are on board I can do a PR

--
components: asyncio
messages: 366722
nosy: Jeff.Laughlin, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Add ability to specify instance of contextvars context to Task() & 
asyncio.create_task()
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



[issue40179] Argument Clinic incorretly translates #elif

2020-04-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +18921
pull_request: https://github.com/python/cpython/pull/19584

___
Python tracker 

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



[issue40179] Argument Clinic incorretly translates #elif

2020-04-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +18920
pull_request: https://github.com/python/cpython/pull/19583

___
Python tracker 

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



[issue40179] Argument Clinic incorretly translates #elif

2020-04-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 12446e6a605f066d837d3a595d0a73e4f3b43b65 by Serhiy Storchaka in 
branch 'master':
bpo-40179: Fix translation of #elif in Argument Clinic (GH-19364)
https://github.com/python/cpython/commit/12446e6a605f066d837d3a595d0a73e4f3b43b65


--

___
Python tracker 

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



[issue40317] inspect.getsource() examines incorrect target

2020-04-18 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This will be resolved hopefully resolved using 
https://github.com/python/cpython/pull/10307 . Using my patch on the reproducer 
in the report.

./python bpo40317.py
123
class Number:
payload = 123

321
class Number:
payload = 321

--
nosy: +xtreak

___
Python tracker 

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



[issue40301] zipfile module: new feature (two lines of code), useful for test, security and forensics

2020-04-18 Thread Massimo Sala


Massimo Sala  added the comment:

I choosed to use the internal variable *concat* because
- if I recollect correctly, it is calculated before successive routines;
- I didn't see your solution (!), there is a very nice computed variable in
front of my eyes.

Mmh
1) Reliability
Cannot be sure this always run with malformed files :
for zinfo in zf.infolist():

We can try / except but we loose the computation.
If *concat* is already computed (unless completely damaged files), IMHO my
solution is better.

2) Performance
What are the performance for big files?
Are there file seeks due to traversing zf.infolist() ?

> Daniel wrote:
> the advantage is that it already works in python 2.7 so there is no need
to patch Python

Yes, indeed.

If I am right about the pros of my patch, I stand for it.

Many thanks for you attention.

On Sat, 18 Apr 2020 at 15:45, Daniel Hillier  wrote:

>
> Daniel Hillier  added the comment:
>
> Hi Massimo,
>
> Unless I'm missing something about your requirements, the advantage is that
> it already works in python 2.7 so there is no need to patch Python. Just
> bundle the above function with your analysis tool and you're good to go.
>
> Cheers,
> Dan
>
> On Sat, Apr 18, 2020 at 11:36 PM Massimo Sala 
> wrote:
>
> >
> > Massimo Sala  added the comment:
> >
> > Hi Daniel
> >
> > Could you please elaborate the advantages of your loop versus my two
> lines
> > of code?
> > I don't grasp...
> >
> > Thanks, Massimo
> >
> > On Sat, 18 Apr 2020 at 03:26, Daniel Hillier 
> > wrote:
> >
> > >
> > > Daniel Hillier  added the comment:
> > >
> > > Could something similar be achieved by looking for the earliest file
> > > header offset?
> > >
> > > def find_earliest_header_offset(zf):
> > > earliest_offset = None
> > > for zinfo in zf.infolist():
> > > if earliest_offset is None:
> > > earliest_offset = zinfo.header_offset
> > > else:
> > > earliest_offset = min(zinfo.header_offset, earliest_offset)
> > > return earliest_offset
> > >
> > >
> > > You could also adapt this using
> > >
> > > zinfo.compress_size + len(zinfo.FileHeader())
> > >
> > > to see if there were any sections inside the archive which were not
> > > referenced from the central directory. Not sure if zip files with
> > arbitrary
> > > bytes inside the archive would be valid everywhere, but I think they
> are
> > > using zipfile.
> > >
> > > You can also have zipped content inside an archive which has a valid
> > > fileheader but no reference from the central directory. Those entries
> are
> > > discoverable by implementations which process content serially from the
> > > start of the file but not implementations which rely on the central
> > > directory.
> > >
> > > --
> > > nosy: +dhillier
> > >
> > > ___
> > > Python tracker 
> > > 
> > > ___
> > >
> >
> > --
> >
> > ___
> > Python tracker 
> > 
> > ___
> >
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue35967] Better platform.processor support

2020-04-18 Thread miss-islington


miss-islington  added the comment:


New changeset fb940408cea1fb34fed1418832f240f886dadf57 by Chih-Hsuan Yen in 
branch 'master':
bpo-35967: Skip test with `uname -p` on Android (GH-19577)
https://github.com/python/cpython/commit/fb940408cea1fb34fed1418832f240f886dadf57


--
nosy: +miss-islington

___
Python tracker 

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



[issue40301] zipfile module: new feature (two lines of code), useful for test, security and forensics

2020-04-18 Thread Massimo Sala


Massimo Sala  added the comment:

Sorry I forgot to mention one specific case.
We have valid archives with a starting "blob": digitally signed zip files,
their filename extension is ".zip.p7m".

I agree your tip can be useful to other readers.
Best regards, Sala

On Sat, 18 Apr 2020 at 15:45, Serhiy Storchaka 
wrote:

>
> Serhiy Storchaka  added the comment:
>
> Just check the first 4 bytes of the file. In "normal" ZIP archive they are
> b'PK\3\4' (or b'PK\5\6' if it is empty). It is so reliable as checking the
> offset, and more efficient. It is even more reliable, because a malware can
> have zero ZIP archive offset, but it cannot start with b'PK\3\4'.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue40257] Improve the use of __doc__ in pydoc

2020-04-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Some work is still needed for HTML output. But this code is so different from 
the code for plain text output and so complicated that I was afraid to break 
something. I'll rewrite it in separate issue.

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

___
Python tracker 

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



[issue40257] Improve the use of __doc__ in pydoc

2020-04-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 7e64414f57b70dc5bc0ab19a3162a0735f9bfabf by Serhiy Storchaka in 
branch 'master':
bpo-40257: Improve help for the typing module (GH-19546)
https://github.com/python/cpython/commit/7e64414f57b70dc5bc0ab19a3162a0735f9bfabf


--

___
Python tracker 

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



[issue40301] zipfile module: new feature (two lines of code), useful for test, security and forensics

2020-04-18 Thread Daniel Hillier


Daniel Hillier  added the comment:

Hi Massimo,

Unless I'm missing something about your requirements, the advantage is that
it already works in python 2.7 so there is no need to patch Python. Just
bundle the above function with your analysis tool and you're good to go.

Cheers,
Dan

On Sat, Apr 18, 2020 at 11:36 PM Massimo Sala 
wrote:

>
> Massimo Sala  added the comment:
>
> Hi Daniel
>
> Could you please elaborate the advantages of your loop versus my two lines
> of code?
> I don't grasp...
>
> Thanks, Massimo
>
> On Sat, 18 Apr 2020 at 03:26, Daniel Hillier 
> wrote:
>
> >
> > Daniel Hillier  added the comment:
> >
> > Could something similar be achieved by looking for the earliest file
> > header offset?
> >
> > def find_earliest_header_offset(zf):
> > earliest_offset = None
> > for zinfo in zf.infolist():
> > if earliest_offset is None:
> > earliest_offset = zinfo.header_offset
> > else:
> > earliest_offset = min(zinfo.header_offset, earliest_offset)
> > return earliest_offset
> >
> >
> > You could also adapt this using
> >
> > zinfo.compress_size + len(zinfo.FileHeader())
> >
> > to see if there were any sections inside the archive which were not
> > referenced from the central directory. Not sure if zip files with
> arbitrary
> > bytes inside the archive would be valid everywhere, but I think they are
> > using zipfile.
> >
> > You can also have zipped content inside an archive which has a valid
> > fileheader but no reference from the central directory. Those entries are
> > discoverable by implementations which process content serially from the
> > start of the file but not implementations which rely on the central
> > directory.
> >
> > --
> > nosy: +dhillier
> >
> > ___
> > Python tracker 
> > 
> > ___
> >
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue40301] zipfile module: new feature (two lines of code), useful for test, security and forensics

2020-04-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Just check the first 4 bytes of the file. In "normal" ZIP archive they are 
b'PK\3\4' (or b'PK\5\6' if it is empty). It is so reliable as checking the 
offset, and more efficient. It is even more reliable, because a malware can 
have zero ZIP archive offset, but it cannot start with b'PK\3\4'.

--

___
Python tracker 

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



[issue40301] zipfile module: new feature (two lines of code), useful for test, security and forensics

2020-04-18 Thread Massimo Sala


Massimo Sala  added the comment:

Hi Daniel

Could you please elaborate the advantages of your loop versus my two lines
of code?
I don't grasp...

Thanks, Massimo

On Sat, 18 Apr 2020 at 03:26, Daniel Hillier  wrote:

>
> Daniel Hillier  added the comment:
>
> Could something similar be achieved by looking for the earliest file
> header offset?
>
> def find_earliest_header_offset(zf):
> earliest_offset = None
> for zinfo in zf.infolist():
> if earliest_offset is None:
> earliest_offset = zinfo.header_offset
> else:
> earliest_offset = min(zinfo.header_offset, earliest_offset)
> return earliest_offset
>
>
> You could also adapt this using
>
> zinfo.compress_size + len(zinfo.FileHeader())
>
> to see if there were any sections inside the archive which were not
> referenced from the central directory. Not sure if zip files with arbitrary
> bytes inside the archive would be valid everywhere, but I think they are
> using zipfile.
>
> You can also have zipped content inside an archive which has a valid
> fileheader but no reference from the central directory. Those entries are
> discoverable by implementations which process content serially from the
> start of the file but not implementations which rely on the central
> directory.
>
> --
> nosy: +dhillier
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue40301] zipfile module: new feature (two lines of code), useful for test, security and forensics

2020-04-18 Thread Massimo Sala


Massimo Sala  added the comment:

Hi Serhiy

Thanks for the suggestion but I don't need to analyse different
self-extraction payloads (and I think it is always unreliable, there are
too many self-extractors in the wild).

I spend two words about my work.

I analyze ZIP archives because they are the "incarnation" also of microsoft
OOXML and openoffice OASIS ODF documents.

I always find these kind of files with not zero offset aren't strictly
compliant documents (by their respective file formats specifications).
Sometimes there is a self-extrator, sometimes there are pieces of malware
blobs (outside the ZIP structure or inside it, into the compressed files),
sometimes other errors.

For us checking the offset is very effective: we discard "bad" documents at
maximum speed before any other checks and it is more reliable than
antivirus (checking against specific blobs signatures, everytime changing).
With just a single test we have a 100% go/nogo result. Every colleague
grasp this check, there aren't hard to read and maintain routines.

Massimo

On Sat, 18 Apr 2020 at 09:36, Serhiy Storchaka 
wrote:

>
> Serhiy Storchaka  added the comment:
>
> I am not sure it would help you. There are legitimate files which contain
> a payload followed by the ZIP archive (self-extracting archives, programs
> with embedded ZIP archives). And the malware can make the offset of the ZIP
> archive be zero.
>
> If you want to check whether the file looks like an executable, analyze
> first few bytes of the file. All executable files should start by one of
> well recognized signatures, otherwise the OS would not know how to execute
> them and they would not be malware.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue40319] dict.update() return the updated dict instead of None

2020-04-18 Thread SilentGhost


SilentGhost  added the comment:

This looks like a proposed "enhancement" rather than a bug report. 
Unfortunately, this is not possible for a myriad of reasons, from backward 
compatibility to overall use of mutating methods in Python.

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



[issue40301] zipfile module: new feature (two lines of code), useful for test, security and forensics

2020-04-18 Thread Massimo Sala


Massimo Sala  added the comment:

On Sat, 18 Apr 2020 at 04:37, Steven D'Aprano 
wrote:
If we made an exception for you, then people using Python 2.7 still
couldn't use this feature:
`myzipfile.offset` would fail on code using Python 2.7, 2.7.1, 2.7.2,
2.7.3, ... 2.7.17 and only work with 2.7.18.
Nobody could use it unless their application required 2.7.18.

Yes, it seems to me obvious it will work only with Python 2.7.18, and I see
no problem.
If you need new features, you have always to update (to a new MINOR version
or, like you said, MAJOR version).

I am used to other softwares where some features are backported to older
versions and IMHO it is very useful.
Sometimes you just need a specific feature and it isn't possible to update
to a MAJOR version.
You have to consider there are many legacy softwares, also in business, and
a version leap means a lot of work and tests.

Speaking in general, not only python: if the maintainers backport that
specific feature, bingo! you have only to update to the same MAJOR new
MINOR version. And this is good for the user base, there isn't "one size
fits all".
I shot my bullet but I cannot change python.org way of life.

Steven many thanks for your answers and patience to explain.
BTW yes I will patch python 2.7 sources and compile it... also on legacy,
intranet, centos 5 servers we cannot update :-)

--

___
Python tracker 

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



[issue40247] Logged out of user when running Tkinter

2020-04-18 Thread J


J  added the comment:

Thanks for reaching out. I solved the issue following @tcarroll2's solution 
from: https://github.com/pyenv/pyenv/issues/1375
The issue doesn't occur when using pyenv. It seems that the issue may have been 
caused by python sticking to the mac provided tkinter (version 8.5) instead of 
using a compatible version. With pyenv, I get python 3.7.4 and tkinter version 
8.6.10 and it works flawlessly :)

Steps to reproduce crash: 
- Downloading Python version 3.8+ from python.org
- Typing python3 in terminal, importing tkinter as tk and starting a window 
with tk.Tk()
I am immediately logged out of my user. TkVersion is 8.6

Steps to reproduce weird window in window (my guess due to python using mac 
provided tkinter version 8.5):
- Downloading Python version 3.7.7 or older from python.org or homebrew
- Typing python3 in terminal, importing tkinter as tk and starting a window 
with tk.Tk()
- Voila! window in window created.

No logging out here, but the window created is unusable and glitchy. I tried 
running a tkinter GUI that works fine on other setups and the output was 
missing some widgets etc.

--

___
Python tracker 

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



[issue40315] Incorrect stacksize in code object

2020-04-18 Thread Skip Montanaro


Skip Montanaro  added the comment:

Thanks, Serhiy.

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



[issue40319] dict.update() return the updated dict instead of None

2020-04-18 Thread Dong-hee Na


Dong-hee Na  added the comment:

Python 3.8.2+ (heads/3.8:c496e29c2b, Apr 18 2020, 21:42:41)
[Clang 11.0.3 (clang-1103.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = {"test": 1}
>>> b = {"type": 2}
>>> c = a.update(b)
>>> print(c)
None

--

___
Python tracker 

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



[issue40319] dict.update() return the updated dict instead of None

2020-04-18 Thread Dong-hee Na


Dong-hee Na  added the comment:

Python 3.9.0a5+ (heads/master:c606624af8, Apr 18 2020, 18:42:51)
[Clang 11.0.3 (clang-1103.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> a = {"test": 1}
>>> b = {"type": 2}
>>> c = a.update(b)
>>> print(c)
None

on macOS master branch, the issue is not reproducible.

--
nosy: +corona10

___
Python tracker 

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



[issue40319] dict.update() return the updated dict instead of None

2020-04-18 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Can you please print the output of python -v? Using python 3.8.0 on Linux 
returns None for update method.

--

___
Python tracker 

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



[issue40318] Migrate to SQLite3 trace v2 API

2020-04-18 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


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

___
Python tracker 

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



[issue40319] dict.update() return the updated dict instead of None

2020-04-18 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



[issue40318] Migrate to SQLite3 trace v2 API

2020-04-18 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +ghaering

___
Python tracker 

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



[issue40319] dict.update() return the updated dict instead of None

2020-04-18 Thread AL3X_69


New submission from AL3X_69 :

When a dict is updated with update(), instead of return None, it will return 
the updated dict.

example: 

>>> a = {"test": 1}
>>> b = {"type": 2}
>>> c = a.update(b)
>>> print(c)
{"test": 1, "type": 1}

--
messages: 366703
nosy: AL3X_69
priority: normal
severity: normal
status: open
title: dict.update() return the updated dict instead of None
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue40318] Migrate to SQLite3 trace v2 API

2020-04-18 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
type:  -> enhancement

___
Python tracker 

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



[issue40318] Migrate to SQLite3 trace v2 API

2020-04-18 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

Currently, we're using the sqlite3_trace() for tracing statements. This API was 
been superseded by sqlite3_trace_v2() in SQLite3 v3.14 back in August 2016. 
Proposing to migrate to the new API, which allows more fine grained control 
over what to trace, and also opens up the door to stuff like prepared statement 
status variables.

See https://sqlite.org/c3ref/trace_v2.html, 
https://sqlite.org/c3ref/c_trace.html, 
https://sqlite.org/c3ref/c_stmtstatus_counter.html, and 
https://sqlite.org/c3ref/experimental.html.

Attached patch (against master) uses the new API if available. Make test 
completes without failures.

--
components: Library (Lib)
files: 0002-Use-new-sqlite3_trace_v2-API-if-possible.patch
keywords: patch
messages: 366702
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: Migrate to SQLite3 trace v2 API
versions: Python 3.8, Python 3.9
Added file: 
https://bugs.python.org/file49073/0002-Use-new-sqlite3_trace_v2-API-if-possible.patch

___
Python tracker 

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



[issue40317] inspect.getsource() examines incorrect target

2020-04-18 Thread Grzegorz Krasoń

New submission from Grzegorz Krasoń :

Based on the attached example:

Expected output:
```
123
class Number:
payload = 123

321
class Number:
payload = 321
```

Actual output:
```
123
class Number:
payload = 123

321
class Number:
payload = 123
```

Reproduced using:

* Python 2.7.17
* Python 3.7.7
* Python 3.8.2

--
components: Library (Lib)
files: demo.py
messages: 366701
nosy: Grzegorz Krasoń
priority: normal
severity: normal
status: open
title: inspect.getsource() examines incorrect target
type: behavior
versions: Python 2.7, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49072/demo.py

___
Python tracker 

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



[issue40316] Add zero function to time, datetime, which acts as the use case of replace to limit resolution

2020-04-18 Thread Or Toledano


Or Toledano  added the comment:

The use-case for this method is to "limit" the resolution of a time object.
I encountered the need for it when I needed to reduce the resolution of some 
timestamps, to compare them with timestamps of lesser resolution.
I found the following SOF post: 
https://stackoverflow.com/questions/13838394/can-i-easily-get-datetime-with-less-resolution-in-python
which made me think that a zero function can be nice for that use case of 
datetime.replace

--

___
Python tracker 

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



[issue40316] Add zero function to time, datetime, which acts as the use case of replace to limit resolution

2020-04-18 Thread SilentGhost


SilentGhost  added the comment:

What is the use-case for this new method?

--
nosy: +SilentGhost

___
Python tracker 

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



[issue40028] Math module method to find prime factors for non-negative int n

2020-04-18 Thread Ross Rhodes


Ross Rhodes  added the comment:

Unable to dedicate time to this issue under the change of circumstances. Happy 
for someone else to re-open this if they take an interest in picking up this 
work.

--
resolution:  -> postponed
stage: needs patch -> 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



[issue40316] Add zero function to time, datetime, which acts as the use case of replace to limit resolution

2020-04-18 Thread Or Toledano


Or Toledano  added the comment:

https://github.com/python/cpython/pull/19580

--

___
Python tracker 

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



[issue40316] Add zero function to time, datetime, which acts as the use case of replace to limit resolution

2020-04-18 Thread Or Toledano


New submission from Or Toledano :

I propose the zero(time_unit) function, which replaces all time units with 
greater equal resolution than time_unit by 0.
E.g. 
>>> datetime.datetime(2020, 4, 18, 12, 27, 30, 500).zero("second")
datetime.datetime(2020, 4, 18, 12, 27)
I purpose it for the datetime, time classes.
I also added unit tests for the function in those classes.
GitHub PR:

--
components: Library (Lib)
messages: 366696
nosy: Or Toledano, belopolsky, lemburg, p-ganssle
priority: normal
severity: normal
status: open
title: Add zero function to time, datetime, which acts as the use case of 
replace to limit resolution
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



[issue40316] Add zero function to time, datetime, which acts as the use case of replace to limit resolution

2020-04-18 Thread Or Toledano


Change by Or Toledano :


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

___
Python tracker 

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



[issue40301] zipfile module: new feature (two lines of code), useful for test, security and forensics

2020-04-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am not sure it would help you. There are legitimate files which contain a 
payload followed by the ZIP archive (self-extracting archives, programs with 
embedded ZIP archives). And the malware can make the offset of the ZIP archive 
be zero.

If you want to check whether the file looks like an executable, analyze first 
few bytes of the file. All executable files should start by one of well 
recognized signatures, otherwise the OS would not know how to execute them and 
they would not be malware.

--

___
Python tracker 

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



[issue40315] Incorrect stacksize in code object

2020-04-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The stack size is correct. The unreachable code is left because some code (in 
particularly the lineno setter of the frame object) depends on instructions 
which may be in the unreachable code to determines the boundaries of 
programming blocks. It is safer to keep some unreachable code.

You can just ignore the code which uses the stack past co_stacksize.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue1490384] PC new-logo-based icon set

2020-04-18 Thread SilentGhost


Change by SilentGhost :


--
pull_requests:  -16955

___
Python tracker 

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