[issue33049] itertools.count() confusingly mentions zip() and sequence numbers

2018-03-11 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> This is a strange thing to note though because enumerate 
> would be a better use here.

IIRC, the wording predates the addition of enumerate() and before enumerate() 
grew a *start* argument.  That said, enumerate() just addresses care the most 
common case.  It is still worth mentioning that count() is still useful for the 
general case of adding sequence numbers to data streams woven together by zip() 
-- like the way auto-increment is used in SQL:

from time import ctime

def timestamp():
while True:
yield ctime()
   
def user_request():
while True:
yield input()
 
logged_requests = zip(user_request(), count(1), timestamp(), 
cycle(available_servers))

> it seems like step should instead be mentioned there
> instead of "sequence numbers".

The *step* argument was a late addition to the API and isn't used much in 
practice.  When it is used, its meaning and use case tend to be self-evident 
(i.e. counting 60 seconds at a time, or counting backwards), so it doesn't 
warrant further elaboration.

The sentence as-is is imperfect (it makes you wonder why not just use 
enumerate) but it seems better than either saying less by not mentioning the 
use case or getting too wordy which would place too much emphasis on use cases 
less common that those served by enumerate().  So, my preference is to leave 
the sentence as it stands.  The intent of the two sentences mentioning map() 
and zip() was to hint at the possibilities while still keeping the paragraph 
primary focused on what count() actually does.

--
assignee: docs@python -> rhettinger
priority: normal -> low

___
Python tracker 

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



Re: Stock quote API ?

2018-03-11 Thread Chris Angelico
On Mon, Mar 12, 2018 at 3:19 PM, Irv Kalb  wrote:
>
>> On Mar 10, 2018, at 9:26 PM, Chris Angelico  wrote:
>>
>> On Sun, Mar 11, 2018 at 4:18 PM, Irv Kalb  wrote:
>>> Hi,
>>>
>>> I teach courses on beginning Python (Python3).  In one of my topics, I 
>>> explain how we can write simple programs that reach out to the internet and 
>>> download data (request/response).
>>>
>>> I show a number of examples using:   urllib.request.urlopen( 
>>>  )  to get things like weather data, currency exchange 
>>> rates, etc.
>>>
>>> I just tried my examples again, and they are all working fine, except for 
>>> one.  I had an example where I used the call above to get simple (American) 
>>> stock quotes from Yahoo.  However, with this example, now I get a bunch 
>>> errors.  In tracking it down, I found that Yahoo has shut down this public 
>>> API, discontinued this service.
>>>
>>> So ... I am looking for a replacement.  I have done quite a bit of 
>>> searching, but I have not been able to find a simple way to get a stock 
>>> quote (no need for historical data - most recent price is fine).  I have 
>>> found many examples where people have built custom packages for doing this 
>>> type of thing.  However, I am in a college environment, and I cannot 
>>> install any new packages on the computers there.  I've also seen examples 
>>> of people building SQL-style queries to get this type of information, but 
>>> that's beyond what I am trying to teach.
>>>
>>> Wondering if anyone has any example of an API where I could just make a 
>>> call using Python Standard Library interfaces to get stock quotes?
>>>
>>
>> Check out https://www.alphavantage.co/ for something you can query for
>> free. Extensive and amazingly useful. One of my students did some
>> second-tier analysis on the data they provide as a capstone project on
>> stock trading analysis.
>>
>> You may want to consider, though, modifying the "no new packages"
>> rule. The 'requests' library is WAY better for teaching Python and web
>> APIs than the raw urllib. Get just a small handful of pip-installable
>> packages whitelisted and your life will be better.
>>
>> ChrisA
>>
>
> Hi Chris,
>
> Thank you very much for this.  It is very close to what I am looking for.  I 
> had seen this early in my searches but I didn't go into it in detail because 
> it looked like it was designed to give way more information than I was 
> looking for - for example, the first example is about time series data.
>
> I did look into it today, and I got a free API key to check it out.  It does 
> have the ability to give just a stock quote for a symbol, but it looks like 
> the minimum I can get back is a csv:
>
> symbol,price,volume,timestamp
> MSFT,96.1800,--,2018-03-09 16:01:30
>
> which is easy enough for me to break apart.  I just wish there was a way to 
> eliminate the header line so I wouldn't have to go through an explanation 
> about that.
>
> Thanks very much.  If I can't find another one that just give back a price, 
> I'll probably use this one.

It's usually easier to find a decent API that gives too much info than
to find something that gives exactly what you want - because "what you
want" usually isn't the same as "what someone else wants", and the
easiest way to give both is to give lots of info.

> PS:  The "no new packages" rule is not mine.  It's the rule imposed by the 
> college.  They are the administrators of the computers and I don't have an 
> admin password.
>

Oh, I'm sure. But talk to the college about getting a small number of
packages whitelisted. You don't have to ask for arbitrary package
installation, just for a tiny handful of really REALLY useful
packages. If you were teaching data science with Python, would you
restrict yourself to the standard library, or would you use numpy,
pandas, etc? Web development is the same - while you CAN do everything
with just the stdlib, it's way better to pick up a few well-known
packages that tie in well with that.

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


Re: Stock quote API ?

2018-03-11 Thread Irv Kalb

> On Mar 10, 2018, at 9:26 PM, Chris Angelico  wrote:
> 
> On Sun, Mar 11, 2018 at 4:18 PM, Irv Kalb  wrote:
>> Hi,
>> 
>> I teach courses on beginning Python (Python3).  In one of my topics, I 
>> explain how we can write simple programs that reach out to the internet and 
>> download data (request/response).
>> 
>> I show a number of examples using:   urllib.request.urlopen( 
>>  )  to get things like weather data, currency exchange 
>> rates, etc.
>> 
>> I just tried my examples again, and they are all working fine, except for 
>> one.  I had an example where I used the call above to get simple (American) 
>> stock quotes from Yahoo.  However, with this example, now I get a bunch 
>> errors.  In tracking it down, I found that Yahoo has shut down this public 
>> API, discontinued this service.
>> 
>> So ... I am looking for a replacement.  I have done quite a bit of 
>> searching, but I have not been able to find a simple way to get a stock 
>> quote (no need for historical data - most recent price is fine).  I have 
>> found many examples where people have built custom packages for doing this 
>> type of thing.  However, I am in a college environment, and I cannot install 
>> any new packages on the computers there.  I've also seen examples of people 
>> building SQL-style queries to get this type of information, but that's 
>> beyond what I am trying to teach.
>> 
>> Wondering if anyone has any example of an API where I could just make a call 
>> using Python Standard Library interfaces to get stock quotes?
>> 
> 
> Check out https://www.alphavantage.co/ for something you can query for
> free. Extensive and amazingly useful. One of my students did some
> second-tier analysis on the data they provide as a capstone project on
> stock trading analysis.
> 
> You may want to consider, though, modifying the "no new packages"
> rule. The 'requests' library is WAY better for teaching Python and web
> APIs than the raw urllib. Get just a small handful of pip-installable
> packages whitelisted and your life will be better.
> 
> ChrisA
> 

Hi Chris,

Thank you very much for this.  It is very close to what I am looking for.  I 
had seen this early in my searches but I didn't go into it in detail because it 
looked like it was designed to give way more information than I was looking for 
- for example, the first example is about time series data.  

I did look into it today, and I got a free API key to check it out.  It does 
have the ability to give just a stock quote for a symbol, but it looks like the 
minimum I can get back is a csv:

symbol,price,volume,timestamp
MSFT,96.1800,--,2018-03-09 16:01:30

which is easy enough for me to break apart.  I just wish there was a way to 
eliminate the header line so I wouldn't have to go through an explanation about 
that.  

Thanks very much.  If I can't find another one that just give back a price, 
I'll probably use this one.

Irv

PS:  The "no new packages" rule is not mine.  It's the rule imposed by the 
college.  They are the administrators of the computers and I don't have an 
admin password. 

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


[issue33038] GzipFile doesn't always ignore None as filename

2018-03-11 Thread Diego Argueta

Diego Argueta  added the comment:

Yeah that's fine. Thanks!

--

___
Python tracker 

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



Re: csv module and NULL data byte

2018-03-11 Thread Andrew McNamara
>Any idea why it might throw an exception on encountering a NULL in the 
>input stream? It accepts all other 255 byte values. Was this behaviour 
>intended? Perhaps a comment should be added to the docs.
>Thanks for your work on the module anyway.

The original module was like this - it comes about through the C convention
of null-terminated strings (the module is coded in C). It would have been
fairly involved to removed the restriction, and I would have run the risk
of introducing subtle breakage for a feature nobody had asked for in the
years we were maintaining the module outside the Python core... 8-)

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32719] fatal error raised when Ctrl-C print loop

2018-03-11 Thread Xiang Zhang

Xiang Zhang  added the comment:

Looks to me it's because the KeyboardInterrupt breaks 
`_wait_for_thread_shutdown` and reproduces the situation in #23309. @Antonie, 
do you think anything worth to improve here? Otherwise I'll take this as design.

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



[issue32993] urllib and webbrowser.open() can open w/ file: protocol

2018-03-11 Thread Ned Deily

Change by Ned Deily :


--
stage:  -> resolved
status: pending -> closed
type: security -> 

___
Python tracker 

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



[issue32985] subprocess.Popen: Confusing documentation for restore_signals

2018-03-11 Thread R. David Murray

R. David Murray  added the comment:

Well, I imagine the original author thought of "python" as python itself, not 
the user's python program.  That's certainly how I understood it when I read it 
in your message.  It would not be a bad thing to clarify that, though.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue32982] Parse out invisible Unicode characters?

2018-03-11 Thread R. David Murray

R. David Murray  added the comment:

I think it sounds like a good idea to put the printed representation as a 
repered string, followed by the code point representation in parenthesis, in 
that message after "invalid character".

--
nosy: +r.david.murray

___
Python tracker 

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



[issue32993] urllib and webbrowser.open() can open w/ file: protocol

2018-03-11 Thread Martin Panter

Martin Panter  added the comment:

Hi Yao, I tend to agree with Ned. The support for “file:” URLs is by design. I 
don’t see any security problems. I suggest to close this.

In Issue 11662, it was decided that a web server redirecting to a “file:” URL 
was a security problem. This is because the mechanism that follows the redirect 
is automatic, and the target of the redirect is under the control of the remote 
server, not the local user or program. But other parts of the Python library 
still support “file:” URLs without causing any problems. Those URLs are under 
control of the caller, like in your “poc.py” file.

The /etc/passwd file may be readable by ordinary users. But /etc/shadow may 
require special permission to read, because it holds password hashes. Or it may 
not exist under that name, depending on the OS. If a web application calls 
“urllib.request.urlopen”, I think it is up to the application to validate the 
URL it passes. It may want to deny or limit access to specific directories, URL 
schemes, host names, etc. It is not up to Python to make those decisions.

When I tried your “webbrowser.open” demonstration, it made Firefox offer to 
“download” (i.e. copy) the “ls” executable file. I think this is normal 
behaviour, and does not indicate a security problem. A plausible use-case would 
be opening a local README.html file distributed with a program in a web browser.

--
nosy: +martin.panter
resolution:  -> not a bug
status: open -> pending

___
Python tracker 

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



[issue33021] Some fstat() calls do not release the GIL, possibly hanging all threads

2018-03-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 4484f9dca9149da135bbae035f10a50d20d1cbbb by Antoine Pitrou (Nir 
Soffer) in branch 'master':
bpo-33021: Release the GIL during fstat() calls (GH-6019)
https://github.com/python/cpython/commit/4484f9dca9149da135bbae035f10a50d20d1cbbb


--
nosy: +pitrou

___
Python tracker 

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



Re: Flask: request vs Request

2018-03-11 Thread Andrew Z
 after reading the docs and stackoverflow i got some rudimentary
understanding of Request vs request.
i still don't understand why i PyCharm won't show properties, but it is
tool centric question that hardly belongs to this group.

On Sun, Mar 11, 2018 at 10:02 AM, Andrew Z  wrote:

> Sorry guys. i realized i was "mumbling" .
>
> What is the difference between Request and request?  -   RTFM
> , Andrew
>
> Questions:
>  a. when do i use Request?
>  b. why can't I see any properties of the request?  For example, in
> Michael's tutorial, there is a call for  request.json. PyCharm brings no
> suggestions when i type in "request. "
>
>
>
>
> On Sat, Mar 10, 2018 at 11:30 PM, Mark Lawrence 
> wrote:
>
>> On 11/03/18 04:09, Christopher Mullins wrote:
>>
>>> In the code you linked, I don't see where the *R*equest is used. The
>>> request variable is setup by flask when you annotate the function with
>>> the
>>> resource endpoint and POST method. It contains the content of the request
>>> which can be converted to json if that content type was specified.
>>>
>>>
>> Could you please give some context when you reply, TIA.
>>
>> --
>> My fellow Pythonistas, ask not what our language can do for you, ask
>> what you can do for our language.
>>
>> Mark Lawrence
>>
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>
>
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue18802] ipaddress documentation errors

2018-03-11 Thread Cheryl Sabella

Cheryl Sabella  added the comment:

I've made a PR for Berker's patch.

--

___
Python tracker 

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



[issue18802] ipaddress documentation errors

2018-03-11 Thread Cheryl Sabella

Change by Cheryl Sabella :


--
pull_requests: +5844

___
Python tracker 

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



[issue29804] test_ctypes test_pass_by_value fails on arm64 (aarch64) architecture

2018-03-11 Thread Ned Deily

Ned Deily  added the comment:

OK, PR 1559 (in 3.7.0) for Issue30353 has been backported to 3.6 in PR 5954 for 
release in 3.6.5.  So based on msg312200, I'm going to assume the problem is no 
longer reproducible in 3.6 and close this issue.  If not, please reopen.

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

___
Python tracker 

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



[issue32337] Dict order is now guaranteed, so add tests and doc for it

2018-03-11 Thread Ned Deily

Ned Deily  added the comment:

Raymond, do you want to review the current state of the PR before 3.7.0b4?  
Otherwise, I'll probably ask that it be merged as is.

--
priority: release blocker -> deferred blocker

___
Python tracker 

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



[issue33052] Sporadic segmentation fault in test_datetime

2018-03-11 Thread Antoine Pitrou

New submission from Antoine Pitrou :

Just spotted this in a Travis-CI job:
https://travis-ci.org/python/cpython/jobs/351010039#L2002

I'm not sure there's anything to do but I figured it was worth reporting anyway.

--
components: Library (Lib), Tests
messages: 313623
nosy: belopolsky, pitrou
priority: normal
severity: normal
status: open
title: Sporadic segmentation fault in test_datetime
type: crash
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



[issue32996] Improve What's New in 3.7

2018-03-11 Thread Ned Deily

Ned Deily  added the comment:

Thanks for the comments here.  As noted by Yury in PR 5983:  "Looks good. Keep 
in mind that @elprans and I will edit what's new (as we did for 3.5 & 3.6) 
closer to 3.7 release."

--
nosy: +Elvis.Pranskevichus, yselivanov

___
Python tracker 

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



[issue33023] Unable to copy ssl.SSLContext

2018-03-11 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
type: crash -> behavior

___
Python tracker 

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



[issue33023] Unable to copy ssl.SSLContext

2018-03-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Each connection attempt will require a fresh unadulterated clone of the 
> ssl.SSLContext instance provided by user to avoid any side-effects from prior 
> connection attempts.

What would those side-effects be?

--
nosy: +pitrou

___
Python tracker 

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



[issue32996] Improve What's New in 3.7

2018-03-11 Thread bbayles

bbayles  added the comment:

Two things I'm familiar with that should probably be mentioned in the Library 
updates:

* bpo-32102: New argument capture_output for subprocess.run
* bpo-21417: Added support for setting the compression level for 
zipfile.ZipFile.

--
nosy: +bbayles

___
Python tracker 

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



Re: pip and command line

2018-03-11 Thread Terry Reedy

On 3/11/2018 2:08 PM, GISDude wrote:

On Saturday, March 10, 2018 at 10:28:00 AM UTC-8, Terry Reedy wrote:



Why can't I use pip while in IDLE


Would you expect to use pip in MS Excel?  If you type 'python' at a
command line, and get the '>>>' REPL prompt (google REPL), then your
input goes to the python interpreter, which only accepts python
statements.  The same is true in the IDLE Shell, and when you run python
code in the editor.

[Some 3rd party IDEs have a front end for PIP. I wanted to add this for
IDLE but the project was vetoed when partly done.]


What one can do in any Python REPL or program is to use subprocess to 
call pip.  I used something like the following, recently, to prove it 
could be done, to install numpy from IDLE shell on Windows.


>>> import subprocess as sub
>>> sub.run("pip install numpy", stdout=sub.PIPE, stderr=sub.STDOUT).stdout

But since I have Command Prompt pinned to the taskbar and often open, 
there is no point to this extra typing for me.


--
Terry Jan Reedy

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


[issue33051] IDLE: Create new tab for editor options in configdialog

2018-03-11 Thread Cheryl Sabella

Change by Cheryl Sabella :


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

___
Python tracker 

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



[issue32971] Docs on unittest.TestCase.assertRaises() should clarify context manager details

2018-03-11 Thread R. David Murray

R. David Murray  added the comment:

The implementation is literally that no non-keyword arguments other than the 
exception are given.  If any keyword arguments other than msg are given, you 
get a warning. To say just "no callable" would be about as confusing as the 
'and possibly' given the documented prototype, since in fact any non-keyword 
argument will be assumed to be the callable. So the text is correct as written, 
and I'm not sure how one would make it clearer and still be technically 
correct.  But further suggestions are welcome.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue33051] IDLE: Create new tab for editor options in configdialog

2018-03-11 Thread Cheryl Sabella

New submission from Cheryl Sabella :

Split out editor options from general tab in Config Dialog.

--
assignee: terry.reedy
components: IDLE
messages: 313618
nosy: csabella, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE: Create new tab for editor options in configdialog
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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2018-03-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

This is all fixed in the Python 3 branches now.  I won't bother with Python 2 
as it has quite a different code structure and backporting would take too much 
of my time.

Pox TheGreat, thanks for reporting and the initial patch!

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2018-03-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 069b8d20be8018fbd49ed5aaf64c4caba311e48f by Antoine Pitrou in 
branch '3.6':
[3.6] bpo-31804: Fix multiprocessing.Process with broken standard streams 
(GH-6079) (GH-6081)
https://github.com/python/cpython/commit/069b8d20be8018fbd49ed5aaf64c4caba311e48f


--

___
Python tracker 

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



[issue33048] macOS job broken on Travis CI

2018-03-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I meant that the Travis macOS configuration could indeed be maintained by macOS 
experts, indeed.

The alternative, IMHO, would be to declare that bugs in macOS can appear 
without the offending PR being reverted if it was submitted by a non-macOS 
developer.

--

___
Python tracker 

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



[issue33048] macOS job broken on Travis CI

2018-03-11 Thread Ned Deily

Ned Deily  added the comment:

> This should be simple to fix, though I wonder whether this could be taken 
> over by our macOS maintainers? :-)

I'm not sure what you mean by *this*.  If it's the Travis configuration, I 
don't use Homebrew myself and I have little experience with Travis or with our 
current configuration.  I have seen that the Homebrew project recently changed 
their defaults so that "python" pointed to "python3" and, because of pushback, 
have changed some things (see https://docs.brew.sh/Homebrew-and-Python.html).  
I also see the pre-revert of our .travis.yaml did not try to install the brew 
python3 (https://github.com/python/cpython/pull/3367/files).  Perhaps someone 
more familiar with both can take a quick look.  I'm really busy with other 
things right now.

--
nosy: +brett.cannon, zach.ware -ronaldoussoren

___
Python tracker 

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2018-03-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset ff5d21331ec6cefec6ba5b78d256d8dbcd67a069 by Antoine Pitrou (Miss 
Islington (bot)) in branch '3.7':
bpo-31804: Fix multiprocessing.Process with broken standard streams (GH-6079) 
(GH-6080)
https://github.com/python/cpython/commit/ff5d21331ec6cefec6ba5b78d256d8dbcd67a069


--

___
Python tracker 

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



[issue33049] itertools.count() confusingly mentions zip() and sequence numbers

2018-03-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

For example zip(my_sequence, count(1)).

--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2018-03-11 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
versions: +Python 3.8 -Python 2.7

___
Python tracker 

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



[issue32981] Catastrophic backtracking in poplib (CVE-2018-1060) and difflib (CVE-2018-1061)

2018-03-11 Thread Larry Hastings

Larry Hastings  added the comment:

Is this ready to close?

--

___
Python tracker 

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



[issue32981] Catastrophic backtracking in poplib (CVE-2018-1060) and difflib (CVE-2018-1061)

2018-03-11 Thread Larry Hastings

Larry Hastings  added the comment:


New changeset 937ac1fe069a4dc8471dff205f553d82e724015b by larryhastings (Ned 
Deily) in branch '3.5':
[3.5] bpo-32981: Fix catastrophic backtracking vulns (GH-5955) (#6034)
https://github.com/python/cpython/commit/937ac1fe069a4dc8471dff205f553d82e724015b


--

___
Python tracker 

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



[issue32981] Catastrophic backtracking in poplib (CVE-2018-1060) and difflib (CVE-2018-1061)

2018-03-11 Thread Larry Hastings

Larry Hastings  added the comment:


New changeset 942cc04ae44825ea120e3a19a80c9b348b8194d0 by larryhastings (Ned 
Deily) in branch '3.4':
[3.4] bpo-32981: Fix catastrophic backtracking vulns (GH-5955) (#6035)
https://github.com/python/cpython/commit/942cc04ae44825ea120e3a19a80c9b348b8194d0


--

___
Python tracker 

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2018-03-11 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
pull_requests: +5842

___
Python tracker 

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2018-03-11 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5841

___
Python tracker 

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2018-03-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset e756f66c83786ee82f5f7d45931ae50a6931dd7f by Antoine Pitrou in 
branch 'master':
bpo-31804: Fix multiprocessing.Process with broken standard streams (#6079)
https://github.com/python/cpython/commit/e756f66c83786ee82f5f7d45931ae50a6931dd7f


--

___
Python tracker 

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



[issue33050] Centralized documentation of assumptions made by C code

2018-03-11 Thread Timothy VanSlyke

New submission from Timothy VanSlyke :

It would be nice for those who write C extensions to have a resource that 
explicitly states what assumptions are made by the CPython implementation that 
are otherwise implementation-defined in standard C.  

For example, Python versions >= 3.6 require:
- That UCHAR_MAX is defined to be 255 (from Python.h)
- That fixed-width intXX_t and uintXX_t types are provided in stdint.h and 
inttypes.h (from PEP7)

These two requirements also pretty much guarantee that CHAR_BIT == 8.  These 
kinds of things are nice to know for anybody working with the C API; we can 
make the same assumptions in our own code without having hunt through the API 
docs or the CPython source tree every time something comes up.

>From what I've found, there isn't any component of the documentation that 
>explicitly lists these assumptions in one place (I apologize if there is and I 
>somehow missed it...).  Could this be addressed in the future?  

Thanks!

--
assignee: docs@python
components: Documentation
messages: 313607
nosy: docs@python, tvanslyke
priority: normal
severity: normal
status: open
title: Centralized documentation of assumptions made by C code
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



[issue33049] itertools.count() confusingly mentions zip() and sequence numbers

2018-03-11 Thread Trey Hunner

New submission from Trey Hunner :

>From the itertools documentation: 
>https://docs.python.org/3/library/itertools.html?highlight=itertools#itertools.count

> Also, used with zip() to add sequence numbers.

I'm not certain what the goal of the original sentence was, but I think it's 
unclear as currently written.

I assume this is what's meant:

my_sequence = [1, 2, 3, 4]
for i, item in zip(count(1), my_sequence):
print(i, item)

This is a strange thing to note though because enumerate would be a better use 
here.

my_sequence = [1, 2, 3, 4]
for i, item in enumerate(my_sequence, start=1):
print(i, item)

Maybe what is meant is that count can be used with a step while enumerate 
cannot?

my_sequence = [1, 2, 3, 4]
for i, item in zip(count(step=5), my_sequence):
print(i, item)

If that's the case it seems like step should instead be mentioned there instead 
of "sequence numbers".

--
assignee: docs@python
components: Documentation
messages: 313606
nosy: docs@python, trey
priority: normal
severity: normal
status: open
title: itertools.count() confusingly mentions zip() and sequence numbers
type: enhancement
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2018-03-11 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
superseder: multiprocessing.Process depends on sys.stdout being open -> 

___
Python tracker 

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



[issue33048] macOS job broken on Travis CI

2018-03-11 Thread Antoine Pitrou

New submission from Antoine Pitrou :

Well, it didn't take long. The macOS job broke on Travis CI. Apparently "brew" 
thinks Python 2 and Python 3 are the same thing, so "brew install python3" now 
fails with an error message telling to use "brew upgrade" instead.  But it did 
work before...
https://travis-ci.org/python/cpython/jobs/352036713

This should be simple to fix, though I wonder whether this could be taken over 
by our macOS maintainers? :-)

--
components: Build
messages: 313605
nosy: ned.deily, pitrou, ronaldoussoren
priority: normal
severity: normal
status: open
title: macOS job broken on Travis CI
type: compile error
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



Re: pip and command line

2018-03-11 Thread GISDude
On Saturday, March 10, 2018 at 10:28:00 AM UTC-8, Terry Reedy wrote:
> On 3/10/2018 12:23 PM, GISDude wrote:
> > Hi all,
> > I'm hoping someone could help a wannabe python coder out. I'm an aspiring 
> > Data/AI/ML coder/programmer/datafiend - that might help with my situation.
> > 
> > In my various fits of python downloads, I've managed to download Anaconda, 
> 
> Anaconda is a cpython distribution that comes with various 3rd party 
> modules pre-installed.
> 
> > Pyscripter,
> 
> I am not familiar with this.
> 
> > IDLE(3.6/32 AND 64bit), IDLE 2.7.
> 
> If you are on Windows, you did not download 'IDLE'.  You downloaded 
> various versions of CPython from PSF that include the corresponding 
> versions of IDLE, with its integrated shell and editor, but not the 3rd 
> party modules included with Anaconda.
> 
> If you are just starting with Python, and do not work somewhere that 
> uses 2.7, I would ignore 2.7.  Unless you absolutely need the 32 bit 
> version, I delete it.
> 
> > I'm having a problem using pip:
> > 1. Does one have to use pip in the commandline?
> 
> Yes, use command line programs in a command line console/window.
> 
> > Why can't I use pip while in IDLE
> 
> Would you expect to use pip in MS Excel?  If you type 'python' at a 
> command line, and get the '>>>' REPL prompt (google REPL), then your 
> input goes to the python interpreter, which only accepts python 
> statements.  The same is true in the IDLE Shell, and when you run python 
> code in the editor.
> 
> [Some 3rd party IDEs have a front end for PIP. I wanted to add this for 
> IDLE but the project was vetoed when partly done.]
> 
> > 2. For some unknown reason, I have "defaulted" to use IDLE python 3.6, 32 
> > bit version.
> 
> The order of installation, choices you made during installation, and how 
> you start python.  (With just one python installed, there would be no 
> problem.)  Read the first chapter of 
> https://docs.python.org/3/using/index.html and the chapter for your OS 
> (which you should have specified ;-)
> 
> -- 
> Terry Jan Reedy

Many thanks Terry. I'm back to the proverbial drawing board. On a side note, 
I'm uninstalling ANACONDA and re-installing. Seems like the whold 400mb of the 
win executable is missing a bunch of stuff.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31804] multiprocessing calls flush on sys.stdout at exit even if it is None (pythonw)

2018-03-11 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
pull_requests: +5840

___
Python tracker 

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



[issue33047] "RuntimeError: dictionary changed size during iteration" using trace.py module

2018-03-11 Thread Adrien

New submission from Adrien :

Hello.

I am strangely encountering an error whil trying to run "python -m trace -c 
script.py" on this simple code:

> import multiprocessing
> queue = multiprocessing.Queue()
> queue.put("a")

Which raises on Windows 10 using Python 3.6.3:

> Traceback (most recent call last):
>   File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
> "__main__", mod_spec)
>   File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
> exec(code, run_globals)
>   File "/usr/lib/python3.6/trace.py", line 742, in 
> main()
>   File "/usr/lib/python3.6/trace.py", line 739, in main
> results.write_results(opts.missing, opts.summary, opts.coverdir)
>   File "/usr/lib/python3.6/trace.py", line 258, in write_results
> for filename, lineno in self.counts:
> RuntimeError: dictionary changed size during iteration

Fixing it seems straightforward, but I do not know what is causing the bug 
internally.

--
components: Library (Lib)
messages: 313604
nosy: Delgan
priority: normal
severity: normal
status: open
title: "RuntimeError: dictionary changed size during iteration" using trace.py 
module
type: behavior
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



[issue32996] Improve What's New in 3.7

2018-03-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The most breaking change in 3.7 (according to the statistics of GitHub issues) 
is making async a keyword. But this change is even not mentioned in What's New.

--

___
Python tracker 

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



[issue28788] ConfigParser should be able to write config to a given filename, not only into file object

2018-03-11 Thread Berker Peksag

Change by Berker Peksag :


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



[issue28788] ConfigParser should be able to write config to a given filename, not only into file object

2018-03-11 Thread Matej Cepl

Matej Cepl  added the comment:

OK, Serhiy you have the point: it was just a good exercise for me, but the 
benefit is doubtful. Could somebody close this ticket then?

--

___
Python tracker 

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



[issue28788] ConfigParser should be able to write config to a given filename, not only into file object

2018-03-11 Thread Berker Peksag

Berker Peksag  added the comment:

I agree with Serhiy and Terry. Also, PR 5999 does not accept pathlib.Path() 
objects at the moment. This and Serhiy's following comment are good examples of 
why it shouldn't be added to the standard library in my opinion:

> If combine ConfigParser.write() with builtin open() you will need to
> add support of encoding, errors, buffering, newline, and other
> arguments supported by open(). And don't forgot to update this method
> after adding new parameters to open().

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28788] ConfigParser should be able to write config to a given filename, not only into file object

2018-03-11 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +berker.peksag

___
Python tracker 

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



[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-11 Thread Matt Eaton

Matt Eaton  added the comment:

I agree.  I think an explicit exception message would be appropriate when the 
cast fails to cast from string to int in int(post, 10).

Putting in a PR to fix this now.
https://github.com/python/cpython/pull/6078

--
nosy: +agnosticdev

___
Python tracker 

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



[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-11 Thread Matt Eaton

Change by Matt Eaton :


--
pull_requests: +5838

___
Python tracker 

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



[issue33034] urllib.parse.urlparse and urlsplit not raising ValueError for bad port

2018-03-11 Thread Matt Eaton

Change by Matt Eaton :


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

___
Python tracker 

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



Re: Flask: request vs Request

2018-03-11 Thread Andrew Z
Sorry guys. i realized i was "mumbling" .

What is the difference between Request and request?  -   RTFM
, Andrew

Questions:
 a. when do i use Request?
 b. why can't I see any properties of the request?  For example, in
Michael's tutorial, there is a call for  request.json. PyCharm brings no
suggestions when i type in "request. "




On Sat, Mar 10, 2018 at 11:30 PM, Mark Lawrence 
wrote:

> On 11/03/18 04:09, Christopher Mullins wrote:
>
>> In the code you linked, I don't see where the *R*equest is used. The
>> request variable is setup by flask when you annotate the function with the
>> resource endpoint and POST method. It contains the content of the request
>> which can be converted to json if that content type was specified.
>>
>>
> Could you please give some context when you reply, TIA.
>
> --
> My fellow Pythonistas, ask not what our language can do for you, ask
> what you can do for our language.
>
> Mark Lawrence
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unnoticed traceback in a thread

2018-03-11 Thread Skip Montanaro
> Concretely: instead of "start_new_thread(my_thread_function, ...)",
> I use
>
> def wrapped_thread_function(*args, **kw):
>   try:
> my_thread_function(*args, **kw)
>   except:
> ... do whatever is necessary should "my_thread_function" fails ...
>
> start_new_thread(wrapped_thread_function, ...)
>
> Similar, should you use the "Thread" class (instead of "start_new_thread").

Thanks, that looks like an excellent suggestion.

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


[issue28788] ConfigParser should be able to write config to a given filename, not only into file object

2018-03-11 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

George, your third sentence is missing a closing ')' somewhere.  In the first 
part, I believe you meant that the user is able to create a bad file by 
directly writing other content or calling cf.write more than once.  I don't get 
the part about duplicated sections.

I was otherwise +-0 about the feature until Serhiy articulated the negatives.  
I am now more inclined to close this.

I just reviewed the PR, and the added complications in the test mirror the 
added complication in the code. With the patch as is, we should document that 
if a filename is passed, it would be opened with default args other than the 
mode.

There are other filename or file APIs, but that does not mean that they are 
without problems.  I suspect that at least some date to times before the 
addition of with statements.

--
nosy: +terry.reedy -serhiy.storchaka
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue28788] ConfigParser should be able to write config to a given filename, not only into file object

2018-03-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

What is a problem with writing two lines of code?

with open(...) as f:
config.write(f)

If combine ConfigParser.write() with builtin open() you will need to add 
support of encoding, errors, buffering, newline, and other arguments supported 
by open(). And don't forgot to update this method after adding new parameters 
to open().

I'm -1. Not every two lines of code deserve including as a function in the 
stdlib. This will clutter the user interface, complicate the implementation, 
and add the burden to core developers for maintaining this code.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28788] ConfigParser should be able to write config to a given filename, not only into file object

2018-03-11 Thread Terry J. Reedy

Change by Terry J. Reedy :


--
nosy: +lukasz.langa

___
Python tracker 

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



Re: Flask: request vs Request

2018-03-11 Thread Mark Lawrence

On 11/03/18 04:09, Christopher Mullins wrote:

In the code you linked, I don't see where the *R*equest is used. The
request variable is setup by flask when you annotate the function with the
resource endpoint and POST method. It contains the content of the request
which can be converted to json if that content type was specified.



Could you please give some context when you reply, TIA.

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

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


[issue32174] nonASCII punctuation characters can not display in python363.chm.

2018-03-11 Thread Ma Lin

Change by Ma Lin :


Added file: https://bugs.python.org/file47476/screenshot.PNG

___
Python tracker 

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



[issue32174] nonASCII punctuation characters can not display in python363.chm.

2018-03-11 Thread Ma Lin

Ma Lin  added the comment:

Here is a solution:
1, open a page(whatever) with Internet Explorer.
2, right click the page -> Encoding -> check "Auto-Select"
Then the wrong characters (�/抯) will disappear forever.

> Does anyone else see this problem?
Probably a lot of people have this problem.
I installed a clean Windows 10 recently, I believe it's the default visual 
effect of Python .chm document.
BTW my local is Simplified Chinese.

--
nosy: +Ma Lin

___
Python tracker 

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



PyCon Israel 2018 CFP is Open

2018-03-11 Thread Miki Tebeka
Hi,

PyCon Israel 2018 call for papers is open, submit a talk today, another three 
tomorrow :)

See more at http://il.pycon.org/2018/

All the best,
--
Miki
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue32576] concurrent.futures.thread deadlock due to Queue in weakref callback

2018-03-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Perhaps the gemato issue has nothing to do with multiprocessing indeed.  I 
would suggest add some progress logging to your program to see whether/where it 
actually hangs.

--

___
Python tracker 

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



[issue22087] asyncio: support multiprocessing (support fork)

2018-03-11 Thread Zac Medico

Change by Zac Medico :


--
nosy: +zmedico

___
Python tracker 

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



[issue17288] cannot jump from a 'return' or 'exception' trace event

2018-03-11 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

Serhiy, I have updated the tests for using the jump_test() decorator and 
replied to your comment about RETURN_VALUE.

--

___
Python tracker 

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



[issue33016] nt._getfinalpathname may use uninitialized memory

2018-03-11 Thread Eryk Sun

Eryk Sun  added the comment:

> pathlib currently expects DOS paths only: it will strip '\\?\' 
> prefix in resolve()

pathlib's unqualified conversion from the extended form to classic DOS form is 
a bug. The resolved path may be invalid as a classic DOS path. It may be too 
long, a DOS device name (e.g. "nul.txt"), or end with trailing spaces or dots 
(e.g. "spam."). 

Here's another pathlib bug with device paths:

>>> print(pathlib.Path(r'\\.\C:'))
\\.\C:\
>>> print(pathlib.Path('//./CON'))
\\.\CON\

In the first case, the input path is the "C:" volume device, but pathlib 
changes it to the file-system root directory. The second case is invalid in 
general, though some devices will ignore a remaining path.

As background, note that the Windows runtime library classifies paths into 6 
types:

>>> ntdll = ctypes.WinDLL('ntdll')
>>> GetDosPathNameType = ntdll.RtlDetermineDosPathNameType_U

UNC Absolute
>>> GetDosPathNameType(r'\\eggs\spam')
1

Drive Absolute
>>> GetDosPathNameType(r'C:\spam')
2

Drive Relative
>>> GetDosPathNameType('C:spam')
3

Rooted
>>> GetDosPathNameType(r'\spam')
4

Relative
>>> GetDosPathNameType('spam')
5

Local Device
>>> GetDosPathNameType(r'\\.\C:\spam')
6
>>> GetDosPathNameType(r'\\?\C:\spam')
6

A local-device path is always absolute, so it's the only way to reference a 
volume device by a DOS drive letter. Without the prefix, "C:" is a 
drive-relative path.

If the prefix is exactly "?\\" (no forward slashes), then a local-device 
path is an extended path. This path type never gets normalized in any way, 
except to replace the WinAPI prefix with NTAPI "\\??\\". For all other 
local-device paths, the runtime library resolves "." and ".." components, 
translates forward slash to backslash, and strips trailing spaces and dots from 
the final component. Unlike DOS paths, local-device paths do not reserve DOS 
device names (e.g. "NUL" or "NUL:").

pathlib should never add a trailing slash to a local-device path. Also, the 
is_reserved() method needs to distinguish the DOS, device (".\\"), and 
extended device ("?\\") namespaces.

> it would indeed be nice if pathlib handled [device] paths in its resolve()

I suggested handling volume GUID and device paths in _getfinalpathname, so it's 
not special-cased just in pathlib (e.g. if we were to implement 
ntpath.realpath). OTOH, pathlib's resolve() method should handle high-level 
mitigation, such as working around bad links and permission errors in 
non-strict mode.

> I erroneously stated that the length of the path could increase 
> between GetFinalPathNameByHandle calls because an intermediate
> directory could be renamed

The rules for the rename operation are discussed in the documentation for 
NtSetInformationFile, FileRenameInformation [1], and explained in detail in 
File Systems Algorithms, 2.1.5.14.11 FileRenameInformation [2].

[1]: 
https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/ntifs/ns-ntifs-_file_rename_information
[2]: https://msdn.microsoft.com/en-us/library/ff469527

--

___
Python tracker 

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



[issue32576] concurrent.futures.thread deadlock due to Queue in weakref callback

2018-03-11 Thread Michał Górny

Michał Górny  added the comment:

Well, according to the reporters disabling GC doesn't help at all. Maybe it's 
another issue.

--

___
Python tracker 

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



[issue12486] tokenize module should have a unicode API

2018-03-11 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

> Why not just bless the existing generate_tokens() function as a public API

We're actually using generate_tokens() from IPython - we wanted a way to 
tokenize unicode strings, and although it's undocumented, it's been there for a 
number of releases and does what we want. So +1 to promoting it to a public API.

In fact, at the moment, IPython has its own copy of tokenize to fix one or two 
old issues. I'm trying to get rid of that and use the stdlib module again, 
which is how I came to notice that we're using an undocumented API.

--
nosy: +takluyver

___
Python tracker 

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



[issue32970] Improve disassembly of the MAKE_FUNCTION instruction

2018-03-11 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



[issue32970] Improve disassembly of the MAKE_FUNCTION instruction

2018-03-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset e2732d3e66eba9ec13f9d55c499f2437ead552db by Serhiy Storchaka in 
branch 'master':
bpo-32970: Improve disassembly of the MAKE_FUNCTION instruction. (GH-5937)
https://github.com/python/cpython/commit/e2732d3e66eba9ec13f9d55c499f2437ead552db


--

___
Python tracker 

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



[issue32946] Speed up import from non-packages

2018-03-11 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



[issue32925] AST optimizer: Change a list into tuple in iterations and containment tests

2018-03-11 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



[issue33026] Fix jumping out of "with" block

2018-03-11 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



[issue33026] Fix jumping out of "with" block

2018-03-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 3854f5885edc8dc67b1aba82fbb525604fbc625b by Serhiy Storchaka 
(Miss Islington (bot)) in branch '2.7':
[2.7] bpo-33026: Fix jumping out of "with" block by setting f_lineno. 
(GH-6026). (GH-6074) (GH-6076)
https://github.com/python/cpython/commit/3854f5885edc8dc67b1aba82fbb525604fbc625b


--

___
Python tracker 

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



[issue32925] AST optimizer: Change a list into tuple in iterations and containment tests

2018-03-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 3f7e9aa2ef215917b9f1521441f67f4ecd33a1bc by Serhiy Storchaka in 
branch 'master':
bpo-32925: Optimized iterating and containing test for literal lists (GH-5842)
https://github.com/python/cpython/commit/3f7e9aa2ef215917b9f1521441f67f4ecd33a1bc


--

___
Python tracker 

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



[issue32946] Speed up import from non-packages

2018-03-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 4e2442505c5e9eec396dcef4d2e6bdd2b6f92fc9 by Serhiy Storchaka in 
branch 'master':
bpo-32946: Speed up "from ... import ..." from non-packages. (GH-5873)
https://github.com/python/cpython/commit/4e2442505c5e9eec396dcef4d2e6bdd2b6f92fc9


--

___
Python tracker 

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



[issue33026] Fix jumping out of "with" block

2018-03-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 20ac11a9fb027f183914bbaaaed091b57c882e54 by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
[3.6] bpo-33026: Fix jumping out of "with" block by setting f_lineno. 
(GH-6026). (GH-6074) (GH-6075)
https://github.com/python/cpython/commit/20ac11a9fb027f183914bbaaaed091b57c882e54


--

___
Python tracker 

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