[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



Re: Getting file extensions [linux fs]

2019-03-30 Thread Paulo da Silva
Às 22:18 de 28/03/19, Cameron Simpson escreveu:
> On 28Mar2019 01:12, Paulo da Silva  wrote:
>> Às 23:09 de 27/03/19, Cameron Simpson escreveu:
...

> 
> Oh, just tangential to this.
> 
> If you were doing this ad hoc, yes calling the filefrag executable is
> very expensive. But if you are always doing a large batch of filenames
> invoking:
> 
>  filefrag lots of filenames here ...>
> and reading from its output can be very effective, because the expense
> of the executable is amortized over all the files - the per file cost is
> much reduced. And it saves you working out how to use the ioctls from
> Python :-)
That's not the case.
I need to do it on some files basis which I don't know in advance.
Using IOCTL, I don't need to parse or unpack the output. Only compare
the output arrays. Besides I need to store many of the outputs. Doing
that from filefrag text output would be unpractical. I needed, at least,
to compress the data. Although may be I might have to compress the ioctl
arrays ... Let's see how big in average is the storage needed.

I have to go with ioctl. I have to open the files anyway, so there is no
overhead for that when calling the ioctl.

Anyway, thank you for the suggestion.

Regards.
Paulo
-- 
https://mail.python.org/mailman/listinfo/python-list


[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



Re: Library for parsing binary structures

2019-03-30 Thread Cameron Simpson

On 30Mar2019 10:29, Paul Moore  wrote:

On Fri, 29 Mar 2019 at 23:21, Cameron Simpson  wrote:


On 27Mar2019 18:41, Paul Moore  wrote:
>I'm looking for a library that lets me parse binary data structures.
>The stdlib struct module is fine for simple structures, but when it
>gets to more complicated cases, you end up doing a lot of the work by
>hand (which isn't that hard, and is generally perfectly viable, but
>I'm feeling lazy ;-))

I wrote my own: cs.binary, available on PyPI. The PyPI page has is
module docs, which I think are ok:

  https://pypi.org/project/cs.binary/


Nice, thanks - that's exactly the sort of pointer I was looking for.
I'll take a look and see how it works for my use case.


I'd be happy to consider adapting some stuff for your use cases; as you 
may imagine it is written to my use cases.


Also, I should point you at the cs.binary.structtuple factory, which 
makes a class for those structures trivially defined with a struct 
format string. As it uses struct for the parse step and transcribe 
steps, so it should be performant. Here's an example from the 
cs.iso14496 module:


 PDInfo = structtuple('PDInfo', '>LL', 'rate initial_delay')

which makes a PDInfo class for 2 big endian unsigned longs with .rate 
and .initial_delay attributes.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


[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



Re: Syntax for one-line "nonymous" functions in "declaration style"

2019-03-30 Thread Ian Kelly
On Sat, Mar 30, 2019, 5:32 AM Alexey Muranov 
wrote:

>
> On ven., Mar 29, 2019 at 4:51 PM, python-list-requ...@python.org wrote:
> >
> > There could perhaps be a special case for lambda expressions such
> >  that,
> > when they are directly assigned to a variable, Python would use the
> > variable name as the function name. I expect this could be
> >  accomplished by
> > a straightforward transformation of the AST, perhaps even by just
> >  replacing
> > the assignment with a def statement.
>
> If this will happen, that is, if in Python assigning a lambda-defined
> function to a variable will mutate the function's attributes, or else,
> if is some "random" syntactically-determined cases
>
> f = ...
>
> will stop being the same as evaluating the right-hand side and
> assigning the result to "f" variable, it will be a fairly good extra
> reason for me to go away from Python.
>

Is there a particular reason you don't like this? It's not too different
from the syntactic magic Python already employs to support the 0-argument
form of super().
-- 
https://mail.python.org/mailman/listinfo/python-list


[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



Re: Why do I need to use pip3 but not pip

2019-03-30 Thread Peter J. Holzer
On 2019-03-30 15:57:55 +0530, Arup Rakshit wrote:
> This is awesome. Now where should I put my source code? I see many folders 
> into it.

You don't. In my opinion virtual environments should be expendable: You
can destroy and recreate them at will. That leaves two possibilies:

1) Use a "central repository" of virtual environments. For example, I
   have a directory ~/venv/ which contains the virtual environments.

   My project directories are elsewhere, so when I'm working on a
   project, I' usually do something like:
% venv project-environment
% cd ~/wrk/project/src
% pip install -r requirements.txt 
   The first (venv is a litte shell function I wrote, see below)
   activates the environment, the second cds to the source code (note
   that the environment and the project don't have to have the same
   name, although they often do), the third installs any required
   packages into the virtual environment (of course I do that only after
   they change, not every time).

2) Put each virtual environment into a subdirectory of the project, like
   this:
.
├── project1
│   ├── src
│   └── venv
└── project2
├── src
└── venv

   Then I would do something like:
% cd project1
% venv
% cd src
% pip install -r requirements.txt

I started with the second method and switched to the first. I like the
flexibility: I can reuse the same environment for multiple projects or
test the same project in multiple environments. I can also easily see
which environments I have and delete them if I don't need them any more
(I can always recreate them with pip install -r requirements.txt)

The requirements.txt file contains the packages your project needs.
Every project should have one. Some people like to generate it
automatically with "pip freeze", but I prefer to write it myself and put
only first-level requirements (not requirements of those requirements)
into it. I also only put version numbers into it if I know that I need a
specific version (or range of versions). Normally getting the newest
version is fine.

Finally, here is my venv function:

venv() {
for d in venv/"$1" ve/"$1" ~/venv/"$1" "$1"
do
if [ -f "$d"/bin/activate ]
then
. "$d"/bin/activate
break
fi
done
}


hp

-- 
   _  | Peter J. Holzer| we build much bigger, better disasters now
|_|_) || because we have much more sophisticated
| |   | h...@hjp.at | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson 


signature.asc
Description: PGP signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Syntax for one-line "nonymous" functions in "declaration style"

2019-03-30 Thread Alexey Muranov



On ven., Mar 29, 2019 at 4:51 PM, python-list-requ...@python.org wrote:
On Thu, Mar 28, 2019 at 2:30 PM Alexey Muranov 


wrote:


 On jeu., mars 28, 2019 at 8:57 PM, Terry Reedy  
wrote:

 > Throwing the name away is foolish.  Testing functions is another
 > situation in which function names are needed for proper report.

 My idea however was to have it as an exact synonyme of an 
assignment of

 a lambda. Assignment is an assignment, it should not modify the
 attributs of the value that is being assigned.


There could perhaps be a special case for lambda expressions such 
that,

when they are directly assigned to a variable, Python would use the
variable name as the function name. I expect this could be 
accomplished by
a straightforward transformation of the AST, perhaps even by just 
replacing

the assignment with a def statement.


If this will happen, that is, if in Python assigning a lambda-defined 
function to a variable will mutate the function's attributes, or else, 
if is some "random" syntactically-determined cases


   f = ...

will stop being the same as evaluating the right-hand side and 
assigning the result to "f" variable, it will be a fairly good extra 
reason for me to go away from Python.


Since this could just as easily be applied to lambda though, I'm 
afraid it

doesn't offer much of a case for the "f(x)" syntactic sugar.


I did not get this. My initial idea was exactly about introducing a 
syntactic sugar for better readability. I've already understood that 
the use cases contradict PEP 8 recommendations.


Alexey.




--
https://mail.python.org/mailman/listinfo/python-list


Re: Python-list Digest, Vol 186, Issue 31

2019-03-30 Thread Alexey Muranov

On ven., Mar 29, 2019 at 4:51 PM, python-list-requ...@python.org wrote:
On Thu, Mar 28, 2019 at 2:30 PM Alexey Muranov 


wrote:


 On jeu., mars 28, 2019 at 8:57 PM, Terry Reedy  
wrote:

 > Throwing the name away is foolish.  Testing functions is another
 > situation in which function names are needed for proper report.

 My idea however was to have it as an exact synonyme of an 
assignment of

 a lambda. Assignment is an assignment, it should not modify the
 attributs of the value that is being assigned.


There could perhaps be a special case for lambda expressions such 
that,

when they are directly assigned to a variable, Python would use the
variable name as the function name. I expect this could be 
accomplished by
a straightforward transformation of the AST, perhaps even by just 
replacing

the assignment with a def statement.


If this will happen, that is, if in Python assigning a lambda-defined 
function to a variable will mutate the function's attributes, or else, 
if is some "random" syntactically-determined cases


f = ...

will stop being the same as evaluating the right-hand side and 
assigning the result to "f" variable, it will be a fairly good extra 
reason for me to go away from Python.


Since this could just as easily be applied to lambda though, I'm 
afraid it

doesn't offer much of a case for the "f(x)" syntactic sugar.


I did not get this. My initial idea was exactly about introducing a 
syntactic sugar for better readability. I've already understood that 
the use cases contradict PEP 8 recommendations.


Alexey.


--
https://mail.python.org/mailman/listinfo/python-list


[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



Re: Library for parsing binary structures

2019-03-30 Thread Paul Moore
On Fri, 29 Mar 2019 at 23:21, Cameron Simpson  wrote:
>
> On 27Mar2019 18:41, Paul Moore  wrote:
> >I'm looking for a library that lets me parse binary data structures.
> >The stdlib struct module is fine for simple structures, but when it
> >gets to more complicated cases, you end up doing a lot of the work by
> >hand (which isn't that hard, and is generally perfectly viable, but
> >I'm feeling lazy ;-))
>
> I wrote my own: cs.binary, available on PyPI. The PyPI page has is
> module docs, which I think are ok:
>
>   https://pypi.org/project/cs.binary/

Nice, thanks - that's exactly the sort of pointer I was looking for.
I'll take a look and see how it works for my use case.

Paul
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why do I need to use pip3 but not pip

2019-03-30 Thread Arup Rakshit
Hi Peter,

This is awesome. Now where should I put my source code? I see many folders into 
it.


Thanks,

Arup Rakshit
a...@zeit.io



> On 30-Mar-2019, at 3:26 PM, Peter Otten <__pete...@web.de> wrote:
> 
> Arup Rakshit wrote:
> 
>> Hello All,
>> 
>> Thanks I got it now.
>> 
>> One related question: Can I use pip3 for example to install packages
>> project specific, but not globally? So that when I delete the project, all
>> of them gone also from my disk.
> 
> For that you can create a "virtual environment":
> 
> $ python3 -m venv foo
> $ cd foo
> $ . bin/activate
> 
> Once you have activated it you can use 'pip' and 'python' to invoke the 
> versions attached to the virtual environment:
> 
> (foo) $ pip install example
> Downloading/unpacking example
>  Downloading example-0.1.0.tar.gz
>  Running setup.py (path:/home/petto/foo/build/example/setup.py) egg_info 
> for package example
> 
> Downloading/unpacking six (from example)
>  Downloading six-1.12.0-py2.py3-none-any.whl
> Installing collected packages: example, six
>  Running setup.py install for example
> 
> Successfully installed example six
> Cleaning up...
> (foo) $ python
> Python 3.4.3 (default, Nov 12 2018, 22:25:49) 
> [GCC 4.8.4] on linux
> Type "help", "copyright", "credits" or "license" for more information.
 import example
 
> 
> Let's get rid of it now:
> 
> (foo) $ deactivate
> $ cd ..
> $ rm -r foo  # everything should be gone
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


[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



Re: Why do I need to use pip3 but not pip

2019-03-30 Thread Peter Otten
Arup Rakshit wrote:

> Hello All,
> 
> Thanks I got it now.
> 
> One related question: Can I use pip3 for example to install packages
> project specific, but not globally? So that when I delete the project, all
> of them gone also from my disk.

For that you can create a "virtual environment":

$ python3 -m venv foo
$ cd foo
$ . bin/activate

Once you have activated it you can use 'pip' and 'python' to invoke the 
versions attached to the virtual environment:

(foo) $ pip install example
Downloading/unpacking example
  Downloading example-0.1.0.tar.gz
  Running setup.py (path:/home/petto/foo/build/example/setup.py) egg_info 
for package example

Downloading/unpacking six (from example)
  Downloading six-1.12.0-py2.py3-none-any.whl
Installing collected packages: example, six
  Running setup.py install for example

Successfully installed example six
Cleaning up...
(foo) $ python
Python 3.4.3 (default, Nov 12 2018, 22:25:49) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import example
>>>

Let's get rid of it now:

(foo) $ deactivate
$ cd ..
$ rm -r foo  # everything should be gone


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why do I need to use pip3 but not pip

2019-03-30 Thread Arup Rakshit
Hello All,

Thanks I got it now.

One related question: Can I use pip3 for example to install packages project 
specific, but not globally? So that when I delete the project, all of them gone 
also from my disk. 

Thanks,

Arup Rakshit
a...@zeit.io



> On 30-Mar-2019, at 2:05 PM, Cameron Simpson  wrote:
> 
> On 30Mar2019 13:50, Arup Rakshit  wrote:
>> When I read this https://pip.pypa.io/en/stable/installing/ it says I have 
>> the pip installed when I installed the python from official doc. But when I 
>> run the `pip` command from shell, I get error, but pip3 works.
>> 
>> ~/python_playground
>> ▶ pip --version
>> 
>> zsh: command not found: pip
>> 
>> ~/python_playground  
>>  
>> ⍉
>> ▶ pip3 --version
>> 
>> pip 18.1 from 
>> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip
>>  (python 3.7)
> 
> Ok, you've installed python 3 on a Mac.
> 
> Historically most systems have shipped with python 2 (from the OS vendor, 
> which is Apple in your case), and the "python" command invokes Python 2.  So 
> python 3 is installed as the "python3" command to avoid confusion.  The "pip" 
> command from your python 3 install looks like it is also installed as "pip3" 
> to avoid confusion.
> 
>> Do I always need to install using pip3 program then?
> 
> Yes, that is correct for this particular install.
> 
> Cheers,
> Cameron Simpson 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


[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



Re: Understanding the MRO with multiple inheritance

2019-03-30 Thread Chris Angelico
On Sat, Mar 30, 2019 at 7:08 PM Arup Rakshit  wrote:
>
> Thanks Chris and Dieter. I think I got it. It seems it follows the __mro__ of 
> the caller class, not the current class __mro_.

That is correct. It is the object that has an MRO, and it's that
object's MRO that matters to super.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[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



Re: Why do I need to use pip3 but not pip

2019-03-30 Thread Nagy László Zsolt

  Hello,

It depends on the operating system. For example on Ubuntu, the default
python version is still 2.7. When you install both python2.7 and python3
on a system, then usually the "pip" will be a symlink to pip version 2
or 3. The default python interpreter can be different on different systems.

The most portable way to run pip with a given version (AFAIK) is to use
"python -m pip" instead of "pip".

E.g.:

python3 -m pip install PACKAGE_NAME

However, there is still a problem when you have multiple python versions
on the same machine. For example, python3.6 and python3.7. On those
systems, python3 will be a symlink to the default one.

For example:

$ which python
/usr/bin/python
$ ls -lah /usr/bin/python

lrwxrwxrwx 1 root root 9 apr   16  2018 /usr/bin/python -> python2.7

$ which python3 
/usr/bin/python3
$ ls -lah /usr/bin/python3

lrwxrwxrwx 1 root root 9 oct   25 13:11 /usr/bin/python3 -> python3.6

Regards,

   Laszlo


2019. 03. 30. 9:20 keltezéssel, Arup Rakshit írta:
> Hi,
>
> When I read this https://pip.pypa.io/en/stable/installing/ it says I
> have the pip installed when I installed the python from official doc.
> But when I run the `pip` command from shell, I get error, but pip3 works.
>
> ~/python_playground ▶ pip --version
>
> zsh: command not found: pip
>
> ~/python_playground ⍉
> ▶ pip3 --version
>
> pip 18.1 from
> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip
> (python 3.7)
>
> Do I always need to install using pip3 program then?
>
>
> Thanks,
>
> Arup Rakshit
> a...@zeit.io
>
>
>


-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why do I need to use pip3 but not pip

2019-03-30 Thread Cameron Simpson

On 30Mar2019 13:50, Arup Rakshit  wrote:
When I read this https://pip.pypa.io/en/stable/installing/ it says I 
have the pip installed when I installed the python from official doc. 
But when I run the `pip` command from shell, I get error, but pip3 
works.


~/python_playground
▶ pip --version

zsh: command not found: pip

~/python_playground 
  ⍉
▶ pip3 --version

pip 18.1 from 
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip
 (python 3.7)


Ok, you've installed python 3 on a Mac.

Historically most systems have shipped with python 2 (from the OS 
vendor, which is Apple in your case), and the "python" command invokes 
Python 2.  So python 3 is installed as the "python3" command to avoid 
confusion.  The "pip" command from your python 3 install looks like it 
is also installed as "pip3" to avoid confusion.



Do I always need to install using pip3 program then?


Yes, that is correct for this particular install.

Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Why do I need to use pip3 but not pip

2019-03-30 Thread Arup Rakshit
Hi,

When I read this https://pip.pypa.io/en/stable/installing/ it says I have the 
pip installed when I installed the python from official doc. But when I run the 
`pip` command from shell, I get error, but pip3 works.

~/python_playground 
   
▶ pip --version

zsh: command not found: pip

~/python_playground 
  ⍉
▶ pip3 --version

pip 18.1 from 
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pip
 (python 3.7)

Do I always need to install using pip3 program then?


Thanks,

Arup Rakshit
a...@zeit.io



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Understanding the MRO with multiple inheritance

2019-03-30 Thread Arup Rakshit
Thanks Chris and Dieter. I think I got it. It seems it follows the __mro__ of 
the caller class, not the current class __mro_. 

if __name__ == '__main__':
print('MRO of SortedIntList {}'.format(SortedIntList.__mro__))
print('MRO of IntList {}'.format(IntList.__mro__))

# MRO of SortedIntList (, , , , )
# MRO of IntList (, , 
)

I thought obj.add(0) goes to the IntList by following its factory class 
__mro__, and then it follows the __mro__ of the current class(IntList) which is 
SimpleList .

Thanks again.


Thanks,

Arup Rakshit
a...@zeit.io



> On 30-Mar-2019, at 7:02 AM, Chris Angelico  wrote:
> 
> On Fri, Mar 29, 2019 at 11:54 PM Arup Rakshit  wrote:
>> 
>> Now when I call the add method on the SortedIntList class’s instance, I was 
>> expecting super.add() call inside the IntList class add method will dispatch 
>> it to the base class SimpleList. But in reality it doesn’t, it rather 
>> forwards it to the SortedList add method. How MRO guides here can anyone 
>> explain please?
>> 
> 
> When you call super, you're saying "go to the next in the MRO". You
> can examine the MRO by looking at SortedIntList.__mro__ - that should
> show you the exact order that methods will be called.
> 
> ChrisA
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


[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



  1   2   >