[issue36466] Adding a way to strip annotations from compiled bytecode

2019-03-30 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Also note that functools.singledispatch depends on type annotations being 
present.¹턒²
 
¹ https://docs.python.org/3/library/functools.html#functools.singledispatch
² https://forum.dabeaz.com/t/singledispatch-and-the-visitor-pattern/395

--

___
Python tracker 

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



[issue36490] Modernize function signature format in Archiving section of shutil doc

2019-03-30 Thread C.A.M. Gerlach


New submission from C.A.M. Gerlach :

In the process of updating the documentation for another issue, I noticed that 
unlike the rest of the shutil doc (and the Python docs in general, not to 
mention those of virtually every Python package), all the functions in the 
[Archiving operations 
section](https://docs.python.org/3/library/shutil.html#archiving-operations) 
uses the old style, difficult to parse nested-bracket notation for the function 
signatures, rather then the modern style displaying them as they would be 
expected to appear in Python code, with clearly and explicitly indicated 
defaults.

Therefore, given all bracketed items are keyword arguments with defaults, and 
there are no cases more complex then the standard linearly-nested brackets, is 
there a particular reason why this was retained? Otherwise, I can go ahead and 
submit a PR to update this.

--
assignee: docs@python
components: Documentation
messages: 339243
nosy: CAM-Gerlach, docs@python
priority: normal
severity: normal
status: open
title: Modernize function signature format in Archiving section of shutil doc
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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Steve Dower


Steve Dower  added the comment:

Thanks, David. I looked at the log quickly and it's what I expected, so I'll 
merge the PR and start advertising the change. Thanks everyone!

--

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Steve Dower


Steve Dower  added the comment:


New changeset 79da388a4016e24c4258dcc62cd0fa9dde0acb5b by Steve Dower in branch 
'master':
bpo-36085: Add installer check for KB2533625 (GH-12636)
https://github.com/python/cpython/commit/79da388a4016e24c4258dcc62cd0fa9dde0acb5b


--

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread David Bolen


David Bolen  added the comment:

Ok, I've verified that on a Win7 system with SP1 but without KB2533625 I get 
the expected block screen at startup.

On my worker (SP1 with KB2533625) it proceeds to the regular installation main 
dialog.

I'm attaching a copy of the install log in the blocking case to the PR as 
requested there.

--

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Steve Dower


Steve Dower  added the comment:

> any chance at a 32-bit version of the installer

Done (on the PR). Thanks!

--

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread David Bolen


David Bolen  added the comment:

I can help with a Win7 test of the installer, but my currently available 
systems are all 32-bit - any chance at a 32-bit version of the installer?

--

___
Python tracker 

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



[issue36485] Add a way to clear all caches

2019-03-30 Thread Michael Foord


Michael Foord  added the comment:

Tests codify knowledge about the system under test, so it doesn't matter that 
the test suite has to know how to clear caches. It's specifically a good thing 
that the test writer knows which caches exist and need clearing, and how to do 
it. The harder thing mighty be determining what scope to do the clearing (per 
test, class or module) bit unittest exposes hooks for fixtures at those points 
for anything that needs doing automatically.

--

___
Python tracker 

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



[issue36293] Nonblocking read sys.stdin raises error

2019-03-30 Thread Martin Panter


Change by Martin Panter :


--
resolution:  -> duplicate

___
Python tracker 

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



[issue36293] Nonblocking read sys.stdin raises error

2019-03-30 Thread Martin Panter

Martin Panter  added the comment:

I wasn’t sure about closing it, in case Cyker came back with more details. E.g. 
what was the use case? Were they mislead by the documentation? Do they just 
think the error should be different, or do they think there should be no error 
in this case?

But I suppose we can close this and keep discussion about non-blocking text 
input together in the existing reports.

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



[issue36480] .strip() unexpected output on Windows

2019-03-30 Thread Eric V. Smith


Change by Eric V. Smith :


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



[issue36480] .strip() unexpected output on Windows

2019-03-30 Thread 78


78 <78alphadevi...@gmail.com> added the comment:

I have read the documentation. It didn't function near what I thought it
did. I've never heard it stripping front and back characters in tutorials.

I solely admit I was wrong in assuming its function.

On Sat, Mar 30, 2019, 3:35 PM Eric V. Smith  wrote:

>
> Eric V. Smith  added the comment:
>
> I cannot run that example on my computer.
>
> Please reduce this to a single line of code, with no imports, that calls
> .strip() and shows your problem. Ideally you will just use constants, and
> not computed strings.
>
> Something like:
>
> >>> 'magenta.zip'.strip('pizamn')
> 'genta.'
>
> And also, show that exact same line of code executed on both platforms.
>
> That said, the problem is likely in your usage of .strip(). Please re-read
> the documentation: it does not remove substrings from a given string, it
> removes any of the given characters from the beginning and end of the
> string.
>
> So, this is correct:
> >>> 'magenta.zip'.strip('pm')
> 'agenta.zi'
>
> You're probably seeing some difference due to upper or lower case
> filenames on the two platforms.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue36485] Add a way to clear all caches

2019-03-30 Thread Michael Foord


Michael Foord  added the comment:

> On 30 Mar 2019, at 23:48, Michael Foord  wrote:
> 
> 
> Michael Foord  added the comment:
> 
> An auto-magic cache clearing mechanism is really tempting. I tend to agree 
> with Raymond though, if code needs and progress a cache clearing mechanism it 
> should be treated and accessible. 

* exposes (not progress)
* tested  (not treated)

Sorry. 
> 
> They're are probably some problematic caches still within unittest however. 
> Do test results still keep alive all tracebacks until test reporting?
> 
> --
> 
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Steve Dower


Steve Dower  added the comment:


New changeset ac19d9652799412404aef6b357a01057df34e005 by Steve Dower in branch 
'master':
bpo-36085: Add additional load flag to ensure DLL loads successfully (GH-12633)
https://github.com/python/cpython/commit/ac19d9652799412404aef6b357a01057df34e005


--

___
Python tracker 

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



[issue36485] Add a way to clear all caches

2019-03-30 Thread Michael Foord


Michael Foord  added the comment:

An auto-magic cache clearing mechanism is really tempting. I tend to agree with 
Raymond though, if code needs and progress a cache clearing mechanism it should 
be treated and accessible. 

They're are probably some problematic caches still within unittest however. Do 
test results still keep alive all tracebacks until test reporting?

--

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Steve Dower


Steve Dower  added the comment:

I attached a build of the updated installer to PR 12636 (it's too big to attach 
here) in case anyone can help me test. It should block right at the start if 
you don't have the update, or else it'll go to the usual screen.

The message just says "install SP1 and all updates" as it always has, though 
the log file specifically refers to the KB. I doubt enough people are going to 
hit this for it to be a huge problem.

Also, I think Eryk was right that Windows 8 apparently does require the 
additional flag. It shouldn't affect what the test is testing, so I put it in 
for all versions. Just waiting on the custom buildbot to start to verify that 
the flag is all that's necessary and not the other changes I tried.

--

___
Python tracker 

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



[issue35403] support application/wasm in mimetypes and http.server

2019-03-30 Thread Martin Panter


Change by Martin Panter :


--
superseder:  -> http.server module sets incorrect mimetype for WebAssembly files

___
Python tracker 

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



[issue35403] support application/wasm in mimetypes and http.server

2019-03-30 Thread Martin Panter

Martin Panter  added the comment:

According to Issue 34758, this was already added to 3.8’s “mimetypes”.

--
nosy: +martin.panter
resolution:  -> out of date
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



[issue36467] IDLE to help with invisible characters

2019-03-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The isprintable() method on str objects may be of help.

--

___
Python tracker 

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



[issue36466] Adding a way to strip annotations from compiled bytecode

2019-03-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

+1 for a command-line option decouples this from eliminating docstrings.  The 
latter generally has no semantic effect, but the former might.

Ideally, we don't want to break non-typing uses of annotations.  One example 
below uses annotations for argument validation and documentation.  Another 
example would be the using __annotations__ for dynamic dispatch.

--- Example ---

>>> class Limit:
def __init__(self, low, high):
self.low = low
self.high = high
def valid(self, x):
return self.low <= x <= self.high
def __repr__(self):
return f'{type(self).__name__}(low={self.low}, 
high={self.high})'
 
>>> def validate(function, parameter, value):
assert function.__annotations__[parameter].valid(value)

>>> def maneuver(thrust: Limit(100, 150), angle: Limit(-10, 20)):
'Engage OMS burn (orbital maneuvering system).'
validate(maneuver, 'thrust', thrust)
validate(maneuver, 'angle', angle)
...
 
>>> help(maneuver)
 
Help on function maneuver in module __main__:

maneuver(thrust: Limit(low=100, high=150), angle: Limit(low=-10, high=20))
Engage OMS burn (orbital maneuvering system).

>>> maneuver(120, 7)
 
>>> maneuver(120, 35)
 
Traceback (most recent call last):
  File "", line 1, in 
maneuver(120, 35)
  File "", line 4, in maneuver
validate(maneuver, 'angle', angle)
  File "", line 2, in validate
assert function.__annotations__[parameter].valid(value)
AssertionError

--

___
Python tracker 

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



[issue36485] Add a way to clear all caches

2019-03-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Not sure that I agree there is a testing need to clear all caches regardless of 
what they do. Test code should explicitly state whether it relies on a 
particular cache being cleared at some particular point in time.

Also, the concept of "need to clear all caches" isn't well-formed.  Would you 
want sys.intern caches to be cleared? What about the internal caches in SQLite? 

And do you think polling for a new magic attribute is the right approach?  We 
would get looser coupling and better control by letting modules register 
themselves as needed.

--- re.py ---

sys.register_cache_clear_function(callback=purge, doc='pattern cache and re 
cache')

--- ipaddress.py --

sys.register(IPv4Address.is_private.is_getter.cache_clear, doc='check for 
private networks)

--
nosy: +rhettinger

___
Python tracker 

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



[issue36480] .strip() unexpected output on Windows

2019-03-30 Thread Eric V. Smith


Eric V. Smith  added the comment:

I cannot run that example on my computer.

Please reduce this to a single line of code, with no imports, that calls 
.strip() and shows your problem. Ideally you will just use constants, and not 
computed strings.

Something like:

>>> 'magenta.zip'.strip('pizamn')
'genta.'

And also, show that exact same line of code executed on both platforms.

That said, the problem is likely in your usage of .strip(). Please re-read the 
documentation: it does not remove substrings from a given string, it removes 
any of the given characters from the beginning and end of the string.

So, this is correct:
>>> 'magenta.zip'.strip('pm')
'agenta.zi'

You're probably seeing some difference due to upper or lower case filenames on 
the two platforms.

--

___
Python tracker 

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



[issue36480] .strip() unexpected output on Windows

2019-03-30 Thread 78


78 <78alphadevi...@gmail.com> added the comment:

import binascii
import os
import re
import sys
import hashlib
import json
import codecs
import threading
import datetime
from multiprocessing.pool import ThreadPool

try:
import PySimpleGUI_Custom as sg
except:
import PySimpleGUI as sg
import time
import multiprocessing
import sys
import pathlib
import random
import io
from PIL import Image
import base64
import multiprocessing

t1 = time.time()
settings = json.load(open("{}settings.txt".format(home_), 'r'))
security = True if settings["SECURITY"] == "True" else False
cpu_ = int(settings["THREADS"])
pool = ThreadPool(processes=int(cpu_))
comp_hash_other_2 = json.load(open('{}{}'.format(home_,
"Input_Data_Hash.txt"), 'r'))
comp_hash_other_ = json.load(open('{}{}'.format(home_,
"Output_Image_Hash.txt"), 'r'))
sort_n(name)
dig = 0
file_lim = len(name) - 1
file_len = len(name)
check = 0
b1 = 0
b2 = 0
b3 = 0
b4 = 0
for i in range(0, new_len):
event, values = main_window.Read(timeout=0)
if dig is file_len or event == "Button":
break
content = open("{}{}".format(input_, str(name[dig])), 'rb').read()
temp_name = str(name[dig]).strip("-{}.bmp".format(dig))
file_ = "{}{}".format(output_, str(temp_name))
open(file_, 'ab').write(content[96:])
dig += 1
progress_bar.UpdateBar(i)
progress_percent.Update(f"{i * 100 // new_len}%")
progress_bar.UpdateBar(current_count=1, max=1)
progress_percent.Update("100%")
check_value = dig / new_len

# The strip method works on all *Nix platforms without error, such
that magenta.zip is magenta.zip

# However, testing it on windows, magenta.zip was turned into agenta.zi

# Testing on Window: https://photos.app.goo.gl/uF1LVG2TyYk33UQy6

On Fri, Mar 29, 2019 at 5:51 PM Eric V. Smith 
wrote:

>
> Eric V. Smith  added the comment:
>
> Please provide the exact code to duplicate the problem.
>
> I suspect this is a problem with your code, not with str.strip and not
> with Windows.
>
> --
> nosy: +eric.smith
> status: open -> pending
>
> ___
> Python tracker 
> 
> ___
>

--
status: pending -> open

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +12568

___
Python tracker 

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



[issue36010] Please provide a .zip Windows release of Python that is not crippled/for embedding only

2019-03-30 Thread jt


jt  added the comment:

Thank you so much for making it happen <3

--

___
Python tracker 

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



[issue36010] Please provide a .zip Windows release of Python that is not crippled/for embedding only

2019-03-30 Thread Steve Dower


Change by Steve Dower :


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



[issue36010] Please provide a .zip Windows release of Python that is not crippled/for embedding only

2019-03-30 Thread Steve Dower


Steve Dower  added the comment:


New changeset 3e78c7c30553baf72b7eb6fe3384d88fff549906 by Steve Dower (Miss 
Islington (bot)) in branch '3.7':
bpo-36010: Add venv to the nuget distribution (GH-12367)
https://github.com/python/cpython/commit/3e78c7c30553baf72b7eb6fe3384d88fff549906


--

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Steve Dower


Steve Dower  added the comment:

Thanks for the info, David! I guess the update isn't part of SP1. I'll add a 
check to the installer and update the note in What's New.

Eryk - my thought on CWD was that the new process was not starting in the 
correct directory, which can sometimes happen. I just started the custom 
buildbots with my fix, so we'll see if it's that or something else.

--

___
Python tracker 

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



[issue36489] add filename_extension_map and/or content-types_map dict(s) to mimetypes

2019-03-30 Thread Daniel Black


New submission from Daniel Black :

In https://bugs.python.org/issue36460 (which should be probably be disregarded 
until AMP is in RFC) I discovered that the types_map dictionary within the 
mimetypes module is a key: str to key: str (1:1) relationship. The reality is 
that many filename extensions commonly support multiple content-types and even 
sub types. A more useful structure might look like:

(fne is "file name extension" aka foo)

{
  '.fne': ['type1/subtype', 'type2/subtype'],
  '.htm': ['text/html', 'text/css', 'text/javascript'],
  '.html': ['text/html', 'text/css', 'text/javascript']
} 

However this seems to compete with the functionality of the types map so 
another consideration is content-types_map where the content-type is the key 
and the pair values are lists of valid filename extensions:

{
  'audio/x-aiff': ['.aifc', '.aiff', '.au'],
  'text/html': ['.html', '.htm']
}

--
messages: 339221
nosy: Daniel Black
priority: normal
severity: normal
status: open
title: add filename_extension_map and/or content-types_map dict(s) to mimetypes

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread David Bolen


David Bolen  added the comment:

I just wanted to acknowledge that this was breaking on my Windows 7 builder 
(with a bad DLL load parameter in both pythoninfo and test steps).

It looks like I was missing the required KB2533625 (the machine is mostly a 
virgin SP1 install), so I've installed that now.  I've restarted the most 
recent build and it's already past both previous error points successfully.

Windows 7 is clearly on the wane, but as there may still be other systems in a 
similar state as my worker, the new KB requirement for 3.8 should probably be 
documented with the release.

--
nosy: +db3l

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Eryk Sun


Eryk Sun  added the comment:

WinDLL('./_sqlite3.dll') succeeds, which just delays the call to 
GetFullPathNameW to the CDLL constructor, so I don't see how the working 
directory is a factor. The difference I see is the lack of the 
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS flag. Try including the individual flags (i.e. 
LOAD_LIBRARY_SEARCH_SYSTEM32, LOAD_LIBRARY_SEARCH_APPLICATION_DIR, 
LOAD_LIBRARY_SEARCH_USER_DIRS) one by one until it works.

We could enable loader snaps in the registry for the Python executable; run it 
as a debugger; and log the debug output to see exactly what the loader is 
failing to find and where it's searching.

--

___
Python tracker 

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



[issue36488] os.sendfile() on BSD and macOS does not return bytes sent on EINTR

2019-03-30 Thread Giampaolo Rodola'


Change by Giampaolo Rodola' :


--
title: os.sendfile() on BSD OSs and macOS does not return bytes sent on EINTR 
-> os.sendfile() on BSD and macOS does not return bytes sent on EINTR

___
Python tracker 

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



[issue36488] os.sendfile() on BSD OSs and macOS does not return bytes sent on EINTR

2019-03-30 Thread Ned Deily


Change by Ned Deily :


--
title: BSD/OSX: os.sendfile() does not return bytes sent on EINTR -> 
os.sendfile() on BSD OSs and macOS does not return bytes sent on EINTR
versions:  -Python 3.6

___
Python tracker 

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



[issue30661] Support tarfile.PAX_FORMAT in shutil.make_archive

2019-03-30 Thread C.A.M. Gerlach


C.A.M. Gerlach  added the comment:

I opened a PR to implement both those changes, and also added some minor 
related clarifications and fixes to the format section of the tarfile docs.

> how tarfile.Tarfile behaves if you tell it to open a PAX_FORMAT archive using 
> GNU_FORMAT or vice-versa

I tested tarfile.Tarfile() and extract_all() on the resulting object with 
several different simple- to moderately-complex (including Unicode filenames) 
real-world pax- and GNU-format archives packed with different archivers, with 
both format=GNU_FORMAT and format=PAX_FORMAT for each one, got no warnings or 
errors with debug=3 and errorlevel=2, and extraction was successful and yielded 
identical results for either format argument, and did not get a PAXHEADERS file 
output for either one. Furthermore, tracing the code, its not clear that 
Tarfile() (with 'r') and extract, etc. use the passed `format`.

Even if so, in order to produce an error after this change but not before, all 
of the following would seem to have to be the case:

* The tarfile being read would have to be in GNU format, i.e. from an external 
source or produced with an older version of Python
* The tarfile would have to make use of specific extended/non-standard GNU tar 
features not tested above
* The user would have to use Tarfile() to open the tarfile, rather than one of 
the other, more common/higher-level methods
* The user's call to Tarfile() would have to have used DEFAULT_FORMAT rather 
than being explicitly specified. and implicitly relied DEFAULT_FORMAT == 
GNU_FORMAT

Therefore, this seems like a very specific corner-case. However, if you think I 
should include it, I'll go ahead with it. Also, let me know if these doc 
changes should have a separate NEWS entry or the previous one adequately covers 
it.

--

___
Python tracker 

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



[issue29553] Argparser does not display closing parentheses in nested mutex groups

2019-03-30 Thread mental


mental  added the comment:

Can this issue be closed?

It's been inactive for a while and all it needs is a contributor to merge and 
close.

Seems to me it's been resolved with PRs 117 and 120, the difference between 
them being 120 drops the inner brackets for the format usage (imo 120 should be 
merged and 117 should be closed).

--
nosy: +mental

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Steve Dower


Steve Dower  added the comment:

Guess the link in the devguide needs fixing... I'm out for the next few hours 
but will give it a go when I'm back.

--

___
Python tracker 

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



[issue36268] Change default tar format to modern POSIX 2001 (pax) for better portability/interop, support and standards conformance

2019-03-30 Thread C.A.M. Gerlach


Change by C.A.M. Gerlach :


--
pull_requests: +12567

___
Python tracker 

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



[issue30661] Support tarfile.PAX_FORMAT in shutil.make_archive

2019-03-30 Thread C.A.M. Gerlach


Change by C.A.M. Gerlach :


--
pull_requests: +12566
stage: needs patch -> patch review

___
Python tracker 

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



[issue36466] Adding a way to strip annotations from compiled bytecode

2019-03-30 Thread Guido van Rossum


Guido van Rossum  added the comment:

+1 from me. Looking for a better way to enable this from the command line.
Our alternative would be to maintain a local patch, since this definitely
helps us.

On Sat, Mar 30, 2019 at 12:04 AM Raymond Hettinger 
wrote:

>
> Raymond Hettinger  added the comment:
>
> -0 At first blush, this seems reasonable. Like removing docstrings, it
> would make the bytecode more compact.  That said, annotations can be used
> for more things than typing (they predate typing and could be used for
> anything). It's unclear whether stripping them might break published
> modules that rely on the annotations being present.
>
> Leaving this feature request open so that it can gather more comments from
> the other devs.
>
> --
> nosy: +rhettinger
>
> ___
> Python tracker 
> 
> ___
>
-- 
--Guido (mobile)

--

___
Python tracker 

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



[issue36488] BSD/OSX: os.sendfile() does not return bytes sent on EINTR

2019-03-30 Thread Giampaolo Rodola'


Change by Giampaolo Rodola' :


--
nosy: +rosslagerwall

___
Python tracker 

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



[issue36488] BSD/OSX: os.sendfile() does not return bytes sent on EINTR

2019-03-30 Thread Giampaolo Rodola'


New submission from Giampaolo Rodola' :

>From "man sendfile" on both OSX and FreeBSD:

<<[EINTR] A signal interrupted sendfile() before it could be completed. If 
specified, the number of bytes successfully sent will be returned in *len.>>

Right now we catch EINTR and simply retry. Instead we should only retry is no 
bytes were sent, else we should return those bytes, similarly to what we do on 
EAGAIN and EBUSY:
https://github.com/python/cpython/blob/2438cdf0e932a341c7613bf4323d06b91ae9f1f1/Modules/posixmodule.c#L8907-L8917

--
components: Library (Lib)
messages: 339214
nosy: giampaolo.rodola
priority: normal
severity: normal
stage: needs patch
status: open
title: BSD/OSX: os.sendfile() does not return bytes sent on EINTR
versions: 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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Zachary Ware


Zachary Ware  added the comment:

Try https://buildbot.python.org/all/#/builders?tags=%2Bcustom instead :)

You can trigger a build by pushing to the `buildbot-custom` branch and if need 
be I can grant you SSH or RDP access to that worker, just let me know.

--

___
Python tracker 

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



[issue36010] Please provide a .zip Windows release of Python that is not crippled/for embedding only

2019-03-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12565

___
Python tracker 

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



[issue36010] Please provide a .zip Windows release of Python that is not crippled/for embedding only

2019-03-30 Thread Steve Dower


Steve Dower  added the comment:


New changeset e724152796a5a41544f52054506c6c2248242a5d by Steve Dower (Paul 
Moore) in branch 'master':
bpo-36010: Add venv to the nuget distribution (GH-12367)
https://github.com/python/cpython/commit/e724152796a5a41544f52054506c6c2248242a5d


--

___
Python tracker 

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



[issue36384] ipaddress Should not reject IPv4 addresses with leading zeroes as ambiguously octal

2019-03-30 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think it should be 3.8 only, and the docs should be updated. Apologies for 
not catching that earlier: I searched via Google, which was a mistake.

--

___
Python tracker 

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



[issue36384] ipaddress Should not reject IPv4 addresses with leading zeroes as ambiguously octal

2019-03-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

See also the article "Ping and FTP Resolve IP Address with Leading Zero as 
Octal" 
(https://web.archive.org/web/20061206211851/http://support.microsoft.com/kb/115388).

This is still true in Windows 10.

So it is safer to reject IPv4 addresses with leading zeros that can be 
ambiguously interpreted. Otherwise this can create a security hole.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue36157] Document PyInterpreterState_Main().

2019-03-30 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

I will work on this in a separate PR.

I opened #issue36487 (https://bugs.python.org/issue36487) to track this.

--

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Steve Dower


Steve Dower  added the comment:

Pushed a potential fix, assuming there's something weird going on with relying 
on cwd rather than full paths (I know there's some weirdness here when paths 
get too long, for example).

Zach - this is one of your buildbots. Can we trigger a run from my branch? (As 
an aside, 
https://buildbot.python.org/all/#/builders?tags=custom.unstable=custom.stable
 is currently showing no builders, but I'm not sure we have a custom one that 
matches the configuration here anyway.)

--

___
Python tracker 

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



[issue36487] Make C-API docs clear about what the "main" interpreter is

2019-03-30 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
assignee:  -> nanjekyejoannah

___
Python tracker 

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



[issue36487] Make C-API docs clear about what the "main" interpreter is

2019-03-30 Thread Joannah Nanjekye


New submission from Joannah Nanjekye :

Following up a discussion on a PR here : 
https://github.com/python/cpython/pull/12238, There is need to make sure the 
C-API docs are clear about what the "main" interpreter is.

--
messages: 339207
nosy: nanjekyejoannah
priority: normal
severity: normal
status: open
title: Make C-API docs  clear about what the "main" interpreter is

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +12564
stage: commit review -> patch review

___
Python tracker 

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



[issue36384] ipaddress Should not reject IPv4 addresses with leading zeroes as ambiguously octal

2019-03-30 Thread Ned Deily

Ned Deily  added the comment:

ipaddress is behaving as documented:

"The following constitutes a valid IPv4 address:

A string in decimal-dot notation, consisting of four decimal integers in the 
inclusive range 0–255, separated by dots (e.g. 192.168.0.1). Each integer 
represents an octet (byte) in the address. Leading zeroes are tolerated only 
for values less than 8 (as there is no ambiguity between the decimal and octal 
interpretations of such strings). [...]"

https://docs.python.org/3/library/ipaddress.html

I can sort of understand imposing that restriction in a Python 2 world where 
leading zeros implied octal and Python 3 outright rejects such forms of 
integers to avoid the ambiguity.  That said, there's no particular reason why 
the components of an IPv4 string acceptable to ipaddress *have* to follow the 
same rules so I'm +0 on making the change at all.  It's a bit of a stretch to 
consider it a bug when it appears to be behaving as documented but I would 
expect such a change to fix more problems than causing them so I'm OK if you 
want to backport it.

But, in any case, the documentation for 3.8 and/or 3.7 needs to be updated.

--
keywords: +3.2regression -patch
resolution: fixed -> 
stage: resolved -> needs patch
status: pending -> open

___
Python tracker 

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



[issue36384] ipaddress Should not reject IPv4 addresses with leading zeroes as ambiguously octal

2019-03-30 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
status: open -> pending

___
Python tracker 

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



[issue36384] ipaddress Should not reject IPv4 addresses with leading zeroes as ambiguously octal

2019-03-30 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +ned.deily
status: pending -> open

___
Python tracker 

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



[issue36384] ipaddress Should not reject IPv4 addresses with leading zeroes as ambiguously octal

2019-03-30 Thread Nick Coghlan


Nick Coghlan  added the comment:

I've merged the change for Python 3.8 (thanks Joel!).

I'm not sure whether to classify it as an enhancement or as an interoperability 
bug fix, though, so I've put the status to pending and added Ned to the nosy 
list to get his thoughts as the Python 3.7 RM.

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

___
Python tracker 

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



[issue36384] ipaddress Should not reject IPv4 addresses with leading zeroes as ambiguously octal

2019-03-30 Thread Nick Coghlan


Nick Coghlan  added the comment:


New changeset e653d4d8e820a7a004ad399530af0135b45db27a by Nick Coghlan (Joel 
Croteau) in branch 'master':
bpo-36384: Remove check for leading zeroes in IPv4 addresses (GH-12577)
https://github.com/python/cpython/commit/e653d4d8e820a7a004ad399530af0135b45db27a


--

___
Python tracker 

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



[issue36486] Bugs and inconsistencies in unicodedata

2019-03-30 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +lemburg

___
Python tracker 

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



[issue36486] Bugs and inconsistencies in unicodedata

2019-03-30 Thread David Corbett

New submission from David Corbett :

In `unicodedata`, the functions `lookup` and `name` have some bugs and 
inconsistencies.

`lookup` matches case-insensitively, except for the algorithmic names of Hangul 
syllables and CJK unified ideographs, which must be in all caps. The 
documentation does not explain how character names are fuzzily matched.

`lookup` accepts names like “CJK UNIFIED IDEOGRAPH-04E00”, where the code point 
has a leading zero.

`lookup` and `name` don’t implement rule NR2, defined in chapter 4 of Unicode, 
for Tangut ideographs’ names.

--
assignee: docs@python
components: Documentation, Unicode
messages: 339203
nosy: docs@python, dscorbett, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: Bugs and inconsistencies in unicodedata
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



[issue36085] Enable better DLL resolution

2019-03-30 Thread Steve Dower


Steve Dower  added the comment:

Acknowledging the buildbot failure at 
https://buildbot.python.org/all/#builders/12/builds/2181

I'll try and take a look today. Apparently Windows 8 has a slightly different 
understanding of the flags used in ctypes tests?

--
nosy: +pablogsal, vstinner

___
Python tracker 

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



[issue19495] context manager for measuring duration of blocks of code

2019-03-30 Thread Nick Coghlan


Nick Coghlan  added the comment:

I think Caleb's "sample_before_and_after" idea hints that this may be an idea 
that could benefit from the ExitStack treatment where contextlib provides a 
building block that handles the interaction with the context management 
machinery, with the documentation shows recipes for particular use cases (such 
as implementing timers for blocks of code)

For example:

class ContextMonitor:
"""Invoke given sampling callbacks when a context is entered and 
exited, and optionally combine the sampling results

*on_entry*: zero-arg sampling function to call on context entry
*on_exit*: zero-arg sampling function to call on context exit
*combine_samples*: two-arg sample combination function. If not given, 
samples are combined as 2-tuples.
*keep_results*: whether to keep results for retrieval via 
``pop_combined_result()``

Instances of this context manager are reusable and reentrant.
"""
def __init__(self, on_entry=None, on_exit=None, combine_samples=None, 
*, keep_results = False):
self._on_entry = lambda:None if on_entry is None else on_entry
self._on_exit = lambda:None if on_exit is None else on_exit
self._combine_samples = lambda *args: args if combine_samples is 
None else combine_samples
self._entry_samples = []
self._keep_results = keep_results
self._combined_results = [] if keep_results else None

@classmethod
def sample(cls, on_event=None, check_results=None):
"""Context monitor that uses the same sampling callback on entry 
and exit"""
return cls(on_event, on_event, check_results)

def pop_combined_result(self):
"""Pops the last combined result. Raises RuntimeError if no results 
are available"""
results = self._combined_results
if not results:
raise RuntimeError("No sample results to report")
return self.checked_results.pop()

def __enter__(self):
self._entry_samples.append(self._on_entry())
return self

def __exit__(self, *args):
entry_sample = self._entry_samples.pop()
exit_sample = self._on_exit()
result = self._combine_samples(entry_sample, exit_sample)
if self._keep_results:
self._combined_results.append(result)
 
And then a recipe like the following (adapted from Caleb's example):

def log_if_slow(logger_name, msg, *args, threshold_sec=1.0, **kwargs):
Context manager that logs monitored blocks that take too long"""
logger = logging.getLogger(logger_name)
if not logger.isEnabledFor(logging.INFO):
# Avoid the timer overhead if the logger will never print anything
return nullcontext()
def _log_slow_blocks(start, end):
duration = end - start
if dt >= threshold_sec:
logger.info(msg, duration, *args, **kwargs)
return ContextMonitor.sample(time.perfcounter, _log_slow_blocks)

with log_if_slow(__name__, 'Took longer to run than expected: %.4g s'):
...


The question is whether anyone would actually find it easier to learn to use an 
API like ContextMonitor over just writing their own generator based context 
manager.

Depending on how familiar they are with the context management protocol, it's 
plausible that they would, as the construction API only asks a few questions:

* whether to use the same sampling function on entry and exit or different ones
* which sampling function(s) to use
* how to combine the two samples into a single result (defaulting to producing 
a two-tuple)
* whether to keep the results around for later retrieval (useful if you want to 
post-process the samples rather than dealing with them directly in the sample 
combination callback)

--

___
Python tracker 

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



[issue24214] UTF-8 incremental decoder doesn't support surrogatepass correctly

2019-03-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue36434] Zipfile breaks if signalled during write()

2019-03-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you for your report Andriy. 3.5 and 3.6 take only security bug fixes.

--
versions:  -Python 3.5, Python 3.6, Python 3.9

___
Python tracker 

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



[issue36434] Zipfile breaks if signalled during write()

2019-03-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue24214] UTF-8 incremental decoder doesn't support surrogatepass correctly

2019-03-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset bd48280cb66544827952ca91e326cbb178c8c461 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.7':
bpo-24214: Fixed the UTF-8 incremental decoder. (GH-12603) (GH-12627)
https://github.com/python/cpython/commit/bd48280cb66544827952ca91e326cbb178c8c461


--

___
Python tracker 

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



[issue36434] Zipfile breaks if signalled during write()

2019-03-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 4724ba9b57c45ce4bca3c828f2ed8dcff3800a0c by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.7':
bpo-36434: Properly handle writing errors in ZIP files. (GH-12559) (GH-12628)
https://github.com/python/cpython/commit/4724ba9b57c45ce4bca3c828f2ed8dcff3800a0c


--

___
Python tracker 

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



[issue34602] python3 resource.setrlimit strange behaviour under macOS

2019-03-30 Thread Chih-Hsuan Yen


Chih-Hsuan Yen  added the comment:

I guess Inada Naoki was to say https://bugs.python.org/issue36432 in the last 
comment.

--
nosy: +yan12125

___
Python tracker 

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



[issue36432] Running python test suite fails on macOS 10.14.4 with resource.RLIMIT_STACK error

2019-03-30 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy: +yan12125

___
Python tracker 

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



[issue36483] Missing line in documentation example

2019-03-30 Thread Luis Muñoz

Luis Muñoz  added the comment:

My bad. 
Sorry for the inconvenience.

--

___
Python tracker 

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



[issue36236] Python crash on macOS when CWD is invalid

2019-03-30 Thread Nick Coghlan


Nick Coghlan  added the comment:

Thanks for sorting this out, Victor!

--
resolution:  -> fixed

___
Python tracker 

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



[issue14934] generator objects can clear their weakrefs before being resurrected

2019-03-30 Thread Nick Coghlan


Nick Coghlan  added the comment:

If I recall correctly, it's the generator destructor that handles throwing in 
``GeneratorExit`` to get the generator to terminate. So this code can resurrect 
a generator as it's being collected by the GC:

def resurrecting(resurrected):
self = yield
try:
yield
finally:
resurrected.append(self)

storage = []
g = resurrecting(storage)
g.send(g) # Give the generator a reference to itself
del g # Now the generator is in a cycle with itself
gc.collect()
gc.collect()
gc.collect()
# Generator has been added to the storage instead of collected
assert len(storage) == 1
# Clear the storage to kill it for real this time
storage.clear()
# Weakrefs shouldn't get called until here

Antoine, does that sound right to you?

--

___
Python tracker 

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



[issue16961] No regression tests for -E and individual environment vars

2019-03-30 Thread Nick Coghlan


Nick Coghlan  added the comment:

Victor Stinner added a great many regression tests in this area for Python 3.7+

--

___
Python tracker 

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



[issue30661] Support tarfile.PAX_FORMAT in shutil.make_archive

2019-03-30 Thread Nick Coghlan


Nick Coghlan  added the comment:

Aye, I agree that changing the default resolves the feature request here. I've 
recategorised this as a documentation issue, as the initial PR only changed the 
`tarfile` documentation, so the impact on `shutil` isn't obvious.

So the changes needed will be:

* add a "What's New" entry for shutil, noting that shtuil.make_archive 
inherited the change in default archive format from tarfile
* corresponding "version changed" note in the shutil.make_archive documentation


An addition to the "Porting" section in What's New may also be needed, 
depending on how tarfile.Tarfile behaves if you tell it to open a PAX_FORMAT 
archive using GNU_FORMAT or vice-versa (tarfile.open and shutil.unpack_archive 
will be fine, since they query the file's own metadata to find out which format 
to use)

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python
stage: patch review -> needs patch

___
Python tracker 

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



[issue36225] Lingering subinterpreters should be implicitly cleared on shutdown

2019-03-30 Thread Nick Coghlan


Nick Coghlan  added the comment:

I think test_embed would be the right home for this, as there's an existing 
test case there for subinterpreter lifecycles and repeated init/finalize 
cycles: 
https://github.com/python/cpython/blob/ddbb978e1065dde21d1662386b26ded359f4b16e/Programs/_testembed.c#L43

The test case here would be similar, but it wouldn't need the outer loop - it 
would just create a handful of subinterpreters, but instead of ending each one 
before creating the next one the way the existing test does, what it would 
instead do is:

* setup as per the existing test case
* create a pair of subinterpeters, using a copy of the existing loop, but 
omitting the `Py_EndInterpreter` call
* switch back to the main interpreter
* create a second pair of subinterpeters
* switch back to the main interpreter
* call Py_Finalize

It also occurs to me that we don't currently have a test case for what happens 
if you call Py_Finalize from a subinterpreter rather than the main interpreter.

--

___
Python tracker 

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



[issue36485] Add a way to clear all caches

2019-03-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +12563
stage:  -> patch review

___
Python tracker 

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



[issue36485] Add a way to clear all caches

2019-03-30 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

Some modules have caches. There is a need to clear all tests before running 
tests. Brett proposed to add in all modules with caches a function with the 
standardized name which is responsible for clearing module related caches. [1]

The proposed PR adds a new function clear_caches() in the sys module. It 
iterates all imported modules and calls function __clearcache__() if it is 
defined.

def clear_caches():
for mod in reversed(list(sys.modules.values())):
if hasattr(mod, '__clearcache__'):
mod.__clearcache__()

clear_caches() will be used in test.regrtest and can be used in user code. The 
PR defines also function __clearcache__ for modules which are cleared manually 
in the current code.

This is a preliminary implementation, bikeshedding is welcome.

[1] https://mail.python.org/pipermail/python-ideas/2019-March/056165.html

--
components: Library (Lib), Tests
messages: 339190
nosy: brett.cannon, ezio.melotti, michael.foord, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Add a way to clear all caches
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



[issue36426] exec() issue when used inside function

2019-03-30 Thread Nick Coghlan


Nick Coghlan  added the comment:

This is not a bug - to enable function level optimisations, the compiler must 
be able to see all local variable names at compile time.

In Python 2.x the exec statement implementation included special code to allow 
even function local variables to be rebound, but that special-casing was 
removed as part of the Python 3 change to convert exec from a statement to a 
builtin function (as per 
https://www.python.org/dev/peps/pep-3100/#core-language )

This means that to use exec() and reliably see the changes it makes to a 
namespace, you have to supply a reliably read/write dictionary of your own. 

Object instance dictionaries work well for this purpose, as you can then access 
the results as attributes on the instance:

```
>>> class Namespace:
... pass
... 
>>> def f():
... ns = Namespace()
... exec("x = 1; y = 2", vars(ns))
... print(ns.x)
... print(ns.y)
... 
>>> f()
1
2
```

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue36484] Can't reorder TLS 1.3 ciphersuites

2019-03-30 Thread Eman Alashwali


New submission from Eman Alashwali :

Wen using the SSL module, I need to be able to reorder the ciphersuites list in 
TLS 1.3. I was able to do this with python using 
SSLContext.set_ciphers(ciphers) when working with TLS 1.2. But this is not 
possible with TLS 1.3 ciphersuites. The need to reorder the ciphersuites is 
needed because one might need a specific order to simulate specific TLS client 
that send the ciphersuites in specific order. Unfortunately this is seems not 
possible now in python with TLS 1.3 as the comment in the documentations says: 
https://docs.python.org/3/library/ssl.html#ssl.SSLContext.set_ciphers

Can you please consider this post as a feature request? Or clarify to me how to 
reorder the ciphersuites list when working with TLS 1.3?

--
assignee: christian.heimes
components: SSL
messages: 339188
nosy: Eman Alashwali, christian.heimes
priority: normal
severity: normal
status: open
title: Can't reorder TLS 1.3 ciphersuites
versions: Python 3.6

___
Python tracker 

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



[issue36469] Stuck during interpreter exit, attempting to take the GIL

2019-03-30 Thread Remy Noel


Remy Noel  added the comment:

Thanks for the advicesand thorough analysis. I'll try to force threads shutdown 
from the cleanup callback but i'd like to dig to the root of this isssue if 
possible.

This is what the thread 7 python backtrace looks like:

(gdb) py-bt
Traceback (most recent call first):
  
  File "/usr/lib/python3.5/threading.py", line 293, in wait
waiter.acquire()
  File "/usr/lib/python3.5/threading.py", line 549, in wait
signaled = self._cond.wait(timeout)
  File "/usr/lib/python3.5/threading.py", line 849, in start
self._started.wait()
  File "...", line 44, in __init__
thr.start()

So we are basically spawning a thread and waiting for it to start (which will 
likely never happen). That seems like a "normal" behaviour for me (from a 
programming standpoint, that is), but this may be another cause of 
never-terminating threads. (unless this is also caused by the headlock and the 
thread is expected to spawn/release the lock even after finalizing.)

Also, i have access to the process that i kept running. Is there any way to me 
to figure out which thread is currently holding the GIL ? I just want to be 
sure i can't get this info myself before we close this ticket (at which point i 
will get rid of the culprit process).

--

___
Python tracker 

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



[issue35947] Update libffi_msvc to current version of libffi

2019-03-30 Thread Zackery Spytz


Change by Zackery Spytz :


--
pull_requests: +12562

___
Python tracker 

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



[issue36483] Missing line in documentation example

2019-03-30 Thread Martin Panter

Martin Panter  added the comment:

Did you read the bracketed paragraph directly below, or try running the code 
with your “break” statement? I expect it would stop at the first prime number 
(two). But the output continues with more prime numbers.

--
nosy: +martin.panter
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



[issue36464] Python 2.7 build install fails intermittently with -j on MacOS

2019-03-30 Thread Martin Panter

Martin Panter  added the comment:

On Linux, Gnu’s “install” command is happy if the target directory already 
exists; it just changes the mode (-m) etc. So the race isn’t a big deal.

This is like the race I described (theoretical at the time) at 
, although that is about $(LIBPC) 
not $(LIBDIR). I suggested adding a separate target (a bit like Paul’s 
“make-directories” suggestion; see my -4.patch in that bug), but it didn’t get 
much support.

A more conservative patch would be a phony target that retains the existing “if 
/ echo / install” logic.

--
nosy: +martin.panter
stage:  -> needs patch

___
Python tracker 

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



[issue36483] Missing line in documentation example

2019-03-30 Thread Luis Muñoz

New submission from Luis Muñoz :

Hi,

https://docs.python.org/3/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops

The example is missing a break at the end of the else statement.

First time reporting here. If there is an error in formating or anything else 
please accept my apologies.

Luis Muñoz

--
assignee: docs@python
components: Documentation
messages: 339184
nosy: Luis Muñoz, docs@python
priority: normal
severity: normal
status: open
title: Missing line in documentation example
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



[issue36426] exec() issue when used inside function

2019-03-30 Thread Domen Jurkovič

Domen Jurkovič  added the comment:

Are there any workarounds - how can we use exec() and on-the-fly created 
variables?
Also, why 'locals()['bar']' is seen by the interpretter, but not ony 'bar'?

--

___
Python tracker 

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



[issue36466] Adding a way to strip annotations from compiled bytecode

2019-03-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

-0 At first blush, this seems reasonable. Like removing docstrings, it would 
make the bytecode more compact.  That said, annotations can be used for more 
things than typing (they predate typing and could be used for anything). It's 
unclear whether stripping them might break published modules that rely on the 
annotations being present.

Leaving this feature request open so that it can gather more comments from the 
other devs.

--
nosy: +rhettinger

___
Python tracker 

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



[issue36482] let struct's internal cache use FIFO policy

2019-03-30 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I don't know that FIFO makessense in the context of how the struct module is 
typically used.  Also rebuilding structs in cheap so there is very little need 
for further optimization.  As far as I can tell, no user has ever reported a 
performance issue with struct (if they had, we could analyze their use case to 
determine an optimal cache strategy).

So, my preference is to leave the code as-is.

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

___
Python tracker 

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



[issue22831] Use "with" to avoid possible fd leaks

2019-03-30 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue22831] Use "with" to avoid possible fd leaks

2019-03-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 172bb39452ae8b3ccdf5d1f23ead46f44200cd49 by Serhiy Storchaka in 
branch 'master':
bpo-22831: Use "with" to avoid possible fd leaks in tools (part 2). (GH-10927)
https://github.com/python/cpython/commit/172bb39452ae8b3ccdf5d1f23ead46f44200cd49


--

___
Python tracker 

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



[issue22831] Use "with" to avoid possible fd leaks

2019-03-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset afbb7a371fb44edc731344eab5b474ad8f7b57d7 by Serhiy Storchaka in 
branch 'master':
bpo-22831: Use "with" to avoid possible fd leaks in tools (part 1). (GH-10926)
https://github.com/python/cpython/commit/afbb7a371fb44edc731344eab5b474ad8f7b57d7


--

___
Python tracker 

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



[issue36434] Zipfile breaks if signalled during write()

2019-03-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12561

___
Python tracker 

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



[issue36434] Zipfile breaks if signalled during write()

2019-03-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 2524fdefc9bb2a97b99319190aeb23703079ad4c by Serhiy Storchaka in 
branch 'master':
bpo-36434: Properly handle writing errors in ZIP files. (GH-12559)
https://github.com/python/cpython/commit/2524fdefc9bb2a97b99319190aeb23703079ad4c


--

___
Python tracker 

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



[issue24214] UTF-8 incremental decoder doesn't support surrogatepass correctly

2019-03-30 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12560

___
Python tracker 

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



[issue17110] sys.argv docs should explaining how to handle encoding issues

2019-03-30 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.7, Python 3.8 -Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue24214] UTF-8 incremental decoder doesn't support surrogatepass correctly

2019-03-30 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 7a465cb5ee7e298cae626ace1fc3e7d97df79f2e by Serhiy Storchaka in 
branch 'master':
bpo-24214: Fixed the UTF-8 incremental decoder. (GH-12603)
https://github.com/python/cpython/commit/7a465cb5ee7e298cae626ace1fc3e7d97df79f2e


--

___
Python tracker 

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