[issue31314] email throws exception with oversized header input

2017-10-10 Thread Dong-hee Na

Dong-hee Na  added the comment:

And my patch was wrong, I will re-upload it soon.

2017-10-11 13:51 GMT+09:00 Dong-hee Na :
>
> Dong-hee Na  added the comment:
>
> I found that when email header's self._firstlinelen value is negative
> then self._split() returns an empty list.
> Because when the self._firstlinelen value is negative value then
> 'targetlen' becomes a negative value.
>
> I will update a patch into calculating self.firstlinelen as same as Python3.
>
> 2017-10-11 0:46 GMT+09:00 Serhiy Storchaka :
>>
>> Serhiy Storchaka  added the comment:
>>
>> PR 3938 fixes this issue, but I'm wondering why self._split() returns an 
>> empty list only for long header names.
>>
>> --
>> nosy: +serhiy.storchaka
>>
>> ___
>> Python tracker 
>> 
>> ___
>
> --
> Chungnam National University | Computer Science & Engineering
>
> Tel: +82 010-3353-9127
> Email: donghee.n...@gmail.com
> Linkedin: https://www.linkedin.com/in/dong-hee-na-2b713b49/
>
> --
>
> ___
> Python tracker 
> 
> ___

-- 
Chungnam National University | Computer Science & Engineering

Tel: +82 010-3353-9127
Email: donghee.n...@gmail.com
Linkedin: https://www.linkedin.com/in/dong-hee-na-2b713b49/

--

___
Python tracker 

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



[issue14369] make __closure__ writable

2017-10-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

This still seems like a reasonable enhancement, but would presumably need 
updates to apply against the 3.7 development branch.

--
versions: +Python 3.7 -Python 3.3

___
Python tracker 

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



[issue31314] email throws exception with oversized header input

2017-10-10 Thread Dong-hee Na

Dong-hee Na  added the comment:

I found that when email header's self._firstlinelen value is negative
then self._split() returns an empty list.
Because when the self._firstlinelen value is negative value then
'targetlen' becomes a negative value.

I will update a patch into calculating self.firstlinelen as same as Python3.

2017-10-11 0:46 GMT+09:00 Serhiy Storchaka :
>
> Serhiy Storchaka  added the comment:
>
> PR 3938 fixes this issue, but I'm wondering why self._split() returns an 
> empty list only for long header names.
>
> --
> nosy: +serhiy.storchaka
>
> ___
> Python tracker 
> 
> ___

-- 
Chungnam National University | Computer Science & Engineering

Tel: +82 010-3353-9127
Email: donghee.n...@gmail.com
Linkedin: https://www.linkedin.com/in/dong-hee-na-2b713b49/

--

___
Python tracker 

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



Re: Lies in education [was Re: The "loop and a half"]

2017-10-10 Thread Bill

Dennis Lee Bieber wrote:

On Tue, 10 Oct 2017 20:48:26 -0400, Bill 
declaimed the following:


cast stones at C/C++.  People started programming in C in the late 70's,
and before that some were programming in B ("B Programming Language"),

Preceded by BCPL (which leads to the joke that the language that
supplants C will be named P)


PL-I has already been taken.  That is a pretty free-wheeling language 
compared to Fortran, where, IIRC, you had to start in the 7th column. 
Oops, hand me another punch card... :)


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


[issue31456] SimpleCookie fails to parse any cookie if an entry has whitespace in the name

2017-10-10 Thread Adam Davis

Adam Davis  added the comment:

Quietly throw out the one bad value, sure. You lose all cookies in your cookie 
string in this scenario. 

I'd expect "ASDF=stuff; ASDF space=more stuff" to at least kick out the values 
that are legal.

--

___
Python tracker 

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



Re: FW: Printing to a file and a terminal at the same time

2017-10-10 Thread Michael Torrie
On 10/10/2017 10:09 AM, Vail, Rick wrote:
> I have a script for Cisco devices that will do configuration or any CLI 
> command.  What I would like to do is print the output to my terminal(windows) 
> and to a file. I can come up with stdout parameters
> To print to a file but not to the screen and when I remove the stdout part it 
> prints to the screen only.
> 
> This prints to a file
> filename  = open("outputfile",'w')
> sys.stdout = filename
> print ("Anything printed will go to the output file")

Is this script interactive?  I'm guessing not. In any case, the
recommended course for any Unix OS is to just use the tee command to
redirect the output both to the terminal and to a file.  Works with
anything that outputs text to standard out.

As for doing it in Python, maybe you can implement your own print-like
function that prints everything out twice. Once to the file and once to
std out.



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


[issue31742] Default to emitting FutureWarning for provisional APIs

2017-10-10 Thread Guido van Rossum

Guido van Rossum  added the comment:

I'm still trying to understand whether there's a specific event (or set of 
events) that's triggered this issue. There is a lot of talk about people can be 
misled but not a single specific example of someone who actually got in trouble 
because a provisional API they were actually using changed.

Given the passion I read in some of the comments it shouldn't be hard to 
collect such stories?

As with every other change proposed to Python, unless there's a clear 
indication that there is an actual problem, I'm not inclined to try to solve it 
preemptively (since the proposed action also may *introduce* new problems). 
Note that I'm not asking for proof that some people don't know what provisional 
means -- I'm looking for evidence of actual situations where someone got bitten.

Also I don't think that people who didn't read the docs have much of a leg to 
stand on. There are plenty of situations where subtle aspects of APIs are not 
guaranteed to be stable (e.g. calling a function with a value that the docs say 
is invalid but that is not actively rejected by some version). And nobody can 
expect that a talk (no matter how clearly presented) is a substitute for 
reading the docs -- a talk on a complex API like asyncio or typing cannot 
possibly cover the whole API (I know, I've tried :-).

That said, we should absolutely change the warnings in the docs.

--

___
Python tracker 

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



[issue31456] SimpleCookie fails to parse any cookie if an entry has whitespace in the name

2017-10-10 Thread Brad Smith

Brad Smith  added the comment:

According to RFC-6265 (which also references RFC-2616 to define "tokens"), the 
space character (and whitespace in general) is not valid in cookie-names or 
cookie-values.

RFC-6265: https://tools.ietf.org/html/rfc6265#section-4.1.1
RFC-2616: https://tools.ietf.org/html/rfc2616#section-2.2

I think it's reasonable for Python to quietly throw away malformed NAME=VALUE 
pairs since web browsers are likely doing the same.

--
nosy: +infinitewarp

___
Python tracker 

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



[issue31753] Unnecessary closure in ast.literal_eval

2017-10-10 Thread Aaron Hall

Aaron Hall  added the comment:

Rejecting and withdrawing with apologies.

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

___
Python tracker 

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



[issue17960] Clarify the required behaviour of locals()

2017-10-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

Nathaniel raised a valid concern about the draft PEP over in 
https://bugs.python.org/issue30744#msg302475, so I've been considering whether 
or not it would be possible to make the write-through proxy idea work without 
introducing other problems.

I think I have a workable design concept for that approach now: 
https://bugs.python.org/issue30744#msg304099

So the next step will be to see if that actually does work as well as I think 
it will, and if so, update the PEP accordingly.

--
nosy: +njs

___
Python tracker 

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



[issue30744] Local variable assignment is broken when combined with threads + tracing + closures

2017-10-10 Thread Nick Coghlan

Nick Coghlan  added the comment:

I've been thinking further about the write-through proxy idea, and I think I've 
come up with a design for one that shouldn't be too hard to implement, while 
also avoiding all of the problems that we want to avoid.

The core of the idea is that the proxy type would just be a wrapper around two 
dictionaries:

- the existing f_locals dictionary
- a new dictionary mapping cell & free variable names to their respective cells 
(note: this may not actually need to be a dict, as a direct reference from the 
proxy back to the frame may also suffice. However, I find it easier to think 
about the design by assuming this will be a lazily initialised dict in its own 
right)

Most operations on the proxy would just be passed through to f_locals, but for 
keys in both dictionaries, set and delete operations would *also* affect the 
cell in the cell dictionary. (Fortunately dict views don't expose any mutation 
methods, or intercepting all changes to the mapping would be a lot trickier)

Frames would gain a new lazily initialised "f_traceproxy" field that defaults 
to NULL/None.

For code objects that don't define or reference any cells, nothing would change 
relative to today.

For code objects that *do* define or reference cells though, tracing would 
change as follows:

* before calling the trace function:
  - f_locals would be updated from the fast locals array and current cell 
values as usual
  - f_locals on the frame would be swapped out for f_traceproxy (creating the 
latter if needed)
* after returning from the trace function:
  - f_locals on the frame would be reset back to bypassing the proxy (so writes 
to f_locals stop being written through to cells when the trace hook isn't 
running)
  - only the actual locals would be written from f_locals back to the fast 
locals array (cell updates are assumed to have already been handled via the 
proxy)

This preserves all current behaviour *except* the unwanted one of resetting 
cells back to their pre-tracehook value after returning from a trace hook:

* code outside trace hooks can't mutate the function level fast locals or cells 
via locals() or frame.f_locals (since their modifications will be overwritten 
immediately before the trace function runs), but *can* treat it as a regular 
namespace otherwise
* code inside trace hooks can mutate function level fast locals and cells just 
by modifying frame.f_locals
* all code can display the current value of function level fast locals and 
cells just by displaying locals() or frame.f_locals
* there's still only one f_locals dictionary per frame, it may just have a 
proxy object intercepting writes to cell variables when a trace hook is running

That way, we can avoid the problem with overwriting cells back to old values, 
*without* enabling arbitrary writes to function locals from outside trace 
functions, and without introducing any tricky new state synchronisation 
problems.

--

___
Python tracker 

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



[issue31751] Support for C++ 11 and/or C++ 14 in python.org installer

2017-10-10 Thread steven Michalske

steven Michalske  added the comment:

This might be a cython issue then, but I will dig into an example case.  Please 
be patient.

--

___
Python tracker 

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



Re: about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread Steve D'Aprano
On Wed, 11 Oct 2017 02:15 am, Paul Moore wrote:

> These are all run-time behaviours, and so there's no way you can check
> for them ahead of time. If you want to be sure setattr is allowed, you
> need to handle possible exceptions:
> 
> try:
> setattr(o, name, value)
> except Exception:
> # deal with the problem


I would say that you should only catch AttributeError here. Anything else is,
in my opinion, a bug in the object o that needs to be spotted and fixed.

Even catching AttributeError is a bit... suspicious. Why exactly are we trying
to attach attributes to arbitrary objects like None or "Hello World"?

But certainly if you get something like UnicodeDecodeError or ImportError from
trying to set an attribute, that's a bug in o.__setattr__ that needs fixing.


-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: Lies in education [was Re: The "loop and a half"]

2017-10-10 Thread Bill

Steve D'Aprano wrote:

On Tue, 10 Oct 2017 06:06 am, Stefan Ram wrote:


In his book about programming, Bjarne Stroustrup writes:

|We try hard to avoid "white lies"; that is, we refrain from
|oversimplified explanations that are clear and easy to
|understand, but not true in the context of real languages and
|real problems.


Bjarne Stroustrup is famous for designing one of the most heavyweight,
baraque, hard-to-understand, difficult-to-use programming languages in common
use. While C++ has many excellent features, and is constrained by the need to
be compatible with C, I don't think many people believe that it is a
well-designed language.



It is a well-designed language.  It is and was carefully thought out. 
One could argue that there are perhaps "too many ways" to do a given 
thing in Python (one could say it's features are "not orthogonal"). I'm 
sure you are familiar with where the language drew its name.   I'm not 
here to "cast stones", I like Python. I just think that you shouldn't 
cast stones at C/C++.  People started programming in C in the late 70's, 
and before that some were programming in B ("B Programming Language"), 
if I recall correctly. Python generally runs "further ways from the 
hardware" than these other languages, and in some sense, it still would, 
*even if* you were able to statically compile it to machine language. To 
me if feels like Python runs like an application.   I don't wish to 
debate this as I have other needs this week. But I felt compelled to try 
to explain why maybe you shouldn't be casting stones at C/C++.


One thing you didn't bring up at all, is that the audiences for the 
languages appears to be different. You still need folks who can encode 
data structures and write device drivers, from scratch.  And "woe" if 
you need performance, such as applications involving AI.


Cheers,
Bill


But even if it were the best language in the world, and Stroustrup the
greatest language designer in the history of computing, what makes you think
that he knows anything about teaching?




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


[issue31742] Default to emitting FutureWarning for provisional APIs

2017-10-10 Thread Amber Brown

Amber Brown  added the comment:

> What happened to "consenting adults"?

Consent does not mean that by using Python, users fully consent to using 
modules that they may not be aware will, to paraphrase Donald, come back to 
bite them in the ass.

Consent requires multiple things:

- Acknowledgement of the benefits involved
- Acknowledgement of the risks involved
- Positive affirmation that these things are accepted.

The spate of PyCon talks on provisional modules (the half dozen asyncio at 
PyCon US last year, and the 2-3+ asyncio talks at every conference I've been to 
since 2014) very much has given the community the first item, and as people 
have expressed interest in the benefits, acknowledge them.

But, CPython does not like at all admitting clearly or explicitly the risks 
involved. From multiple discussions with Nick, an author of the provisional API 
PEP, it has come clear to me that the intended role of provisional software is 
to allow CPython to ship not-production-ready software for testing and API 
usability testing in an experimental capacity. How many people, from reading 
the single line in the docs (which, remember, is not the only path where people 
learned how to use asyncio in 3.4/3.5, and is absent from module 
documentation), did not know this?

Upon discussing this issue with others, a few people admitted that they had no 
idea that provisional APIs existed, that asyncio was one, that typing is one, 
and they had no idea where to look to see if they were using a provisional 
module in their code or their dependencies.

So, it appears that CPython is failing item #2 here, by not adequately 
informing users of the risks. Yes, the warning should be improved (and ought to 
be made bright red, not grey, and actually use the word "warning", not note), 
but we should also take a step to protect the users that may not learn about 
the module through official documentation, and in some cases, may never 
reference it.

Only then can we confidently say that the user is potentially a "consenting 
adult". (Which is maybe interesting language to use nowadays considering 
Python's growth areas contain a lot of school-age education...)

--

___
Python tracker 

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



[issue31754] Documented type of parameter 'itemsize' to PyBuffer_FillContiguousStrides is incorrect.

2017-10-10 Thread Robert Snoeberger

New submission from Robert Snoeberger :

The signature for PyBuffer_FillContiguousStrides in the documentation shows 
that the type of parameter 'itemsize' is Py_ssize_t [1]. This is different from 
the signature in Include/abstract.h which shows that the type as int [2].


[1] https://docs.python.org/3/c-api/buffer.html#c.PyBuffer_FillContiguousStrides
[2] 
https://github.com/python/cpython/blob/49b2734bf12dc1cda80fd73d3ec8896ae3e362f2/Include/abstract.h#L559-L563

--
assignee: docs@python
components: Documentation
messages: 304096
nosy: docs@python, snoeberger
priority: normal
severity: normal
status: open
title: Documented type of parameter 'itemsize' to 
PyBuffer_FillContiguousStrides is incorrect.
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



[issue31741] backports import path can not be overridden in Windows (Linux works fine)

2017-10-10 Thread Chris Caron

Chris Caron  added the comment:

I'm not doing anything unusual.

Just to recap, I installed Python27 (in Windows 7 in my case- but this problem 
happens in Windows 10 too).

I did use `pip` to install packages as you'll see in the screenshot.  But even 
if i rename the `C:\Python27\Lib\site-packages\backports` to 
`ignoreme-backports`.  When i change the PYTHONPATH (from within 
sys.path.insert(0, 'new_path/that/has/a/backports/dir/in/it');

import backports
print backports.__path__
# always prints: C:\Python27\Lib\site-packages\backports

The problem arises because the following code won't work in my program:

from import import ssl_match_hostname

^^ That throws an exception that the package doesn't exist.  It's debugging it 
to the __path__ being incorrect that caused me to create this ticket.

--

___
Python tracker 

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



[issue31741] backports import path can not be overridden in Windows (Linux works fine)

2017-10-10 Thread Chris Caron

Change by Chris Caron :


Added file: https://bugs.python.org/file47210/Python.Test.zip

___
Python tracker 

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



[issue31741] backports import path can not be overridden in Windows (Linux works fine)

2017-10-10 Thread Chris Caron

Change by Chris Caron :


Added file: https://bugs.python.org/file47209/Test.Script.Output.png

___
Python tracker 

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



[issue31741] backports import path can not be overridden in Windows (Linux works fine)

2017-10-10 Thread Chris Caron

Change by Chris Caron :


Added file: https://bugs.python.org/file47208/Test.Script.Backports.Dir.png

___
Python tracker 

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



[issue31741] backports import path can not be overridden in Windows (Linux works fine)

2017-10-10 Thread Chris Caron

Change by Chris Caron :


Added file: https://bugs.python.org/file47207/Test.Directory.png

___
Python tracker 

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



[issue31741] backports import path can not be overridden in Windows (Linux works fine)

2017-10-10 Thread Chris Caron

Change by Chris Caron :


Added file: https://bugs.python.org/file47206/site-packages-Directory.png

___
Python tracker 

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



[issue31741] backports import path can not be overridden in Windows (Linux works fine)

2017-10-10 Thread Chris Caron

Change by Chris Caron :


Added file: https://bugs.python.org/file47205/Test.py

___
Python tracker 

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



Re: Printing to a file and a terminal at the same time

2017-10-10 Thread MRAB

On 2017-10-10 17:00, Vail, Rick wrote:

I have a script for Cisco devices that will do configuration or any CLI 
command.  What I would like to do is print the output to my terminal(windows) 
and to a file. I can come up with stdout parameters
To print to a file but not to the screen and when I remove the stdout part it 
prints to the screen only.

This prints to a file
filename  = open("outputfile",'w')
sys.stdout = filename
print ("Anything printed will go to the output file")

Remove the above and it prints to the terminal, help


Why not define a function that does both?

def my_print(*args, **kwargs):
print(*args, **kwargs)
print(*args, **kwargs, file=output_file)
--
https://mail.python.org/mailman/listinfo/python-list


[issue31749] Request: Human readable byte amounts in the standard library

2017-10-10 Thread Eric V. Smith

Eric V. Smith  added the comment:

A library implementing this should definitely go on PyPI first to shake out 
design issues. Then we'd need a PEP.

As someone who has a simplistic version of this code around, and who's done a 
bit of string formatting, I can assure you that there are a lot of issues to be 
thought through.

- Should it be 0.5M, or 500K? Is there a cutoff to switch over? Is it 
configurable?
- What if I prefer 1000K to 1M? Or even 1,000.0K or 1.000,0K (localized)?
- How many decimals to display? Can you suppress trailing zeros? Should it be 
1.0M, or 1M?
- Space between the number and the units?
- As you mention, MiB vs. MB. And there are schemes where MB means 1000^2 and 
others where MB means 2^20. And as Serhiy says, schemes where 1 MB = 1024000 
bytes. How to handle all of these.
- Localization. Should this be specified as a locale, use the current locale, 
just ignored (see PEP 378 for an example), or have the delimiters passed in?

I'm sure there are other decisions to be made.

If you're serious about this (and I hope you are!), then I think finding 
current best practices both within and outside of the Python universe should be 
researched.

I do like the idea of the "h" format specifier, which would be an argument to 
move it in to the stdlib. That said, we never did come to agreement on 
something much simpler: engineering notation for floats (see issue 8060), 
because no one put the time into writing up a concrete proposal.

--
nosy: +eric.smith

___
Python tracker 

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



[issue30457] Allow retrieve the number of waiters pending for most of the asyncio lock primitives

2017-10-10 Thread Yury Selivanov

Yury Selivanov  added the comment:

Isn't this code equivalent to yours:

async def get(process, key):
try:
return cache[key]
except KeyError:
if key in events:
await events[key].wait()
else:
events[key] = asyncio.Event()

# simulates some IO to get the Key
await asyncio.sleep(0.1)
cache[key] = "some random value"
event.set()

return cache[key]


?

--

___
Python tracker 

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



[issue31753] Unnecessary closure in ast.literal_eval

2017-10-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Test more complex examples including list and dict displays, binary operators.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31537] Bug in readline module documentation example

2017-10-10 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset 10eb14e2c5fe08c4193668530eaef156e07c3674 by Mariatta (Miss 
Islington (bot)) in branch '3.6':
bpo-31537: Update readline documentation example. (GH-3925) (GH-3948)
https://github.com/python/cpython/commit/10eb14e2c5fe08c4193668530eaef156e07c3674


--

___
Python tracker 

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



[issue31537] Bug in readline module documentation example

2017-10-10 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

Fixed. Thanks!

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

___
Python tracker 

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



Unable to run pip in Windows 10

2017-10-10 Thread Michael Cuddehe
I have tried multiple versions, 32 & 64 bit. Same problem.

"This app can't run on your PC. To find a version for your PC, check with
the software publisher."

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


FW: Printing to a file and a terminal at the same time

2017-10-10 Thread Vail, Rick



Rick Vail | Network Engineer
Presidio (NASDAQ: PSDO) | www.presidio.com
12272 Hancock St, Carmel, IN 46032
D: 317.428.6399 | C: 317.847.0493 | 
rv...@presidio.com



[Future. Built.]


Follow us:

[Follow Presidio on Twitter]



From: Vail, Rick
Sent: Tuesday, October 10, 2017 7:04 AM
To: 'python-list@python.org' 
Subject: Printing to a file and a terminal at the same time

I have a script for Cisco devices that will do configuration or any CLI 
command.  What I would like to do is print the output to my terminal(windows) 
and to a file. I can come up with stdout parameters
To print to a file but not to the screen and when I remove the stdout part it 
prints to the screen only.

This prints to a file
filename  = open("outputfile",'w')
sys.stdout = filename
print ("Anything printed will go to the output file")

Remove the above and it prints to the terminal, help




This message w/attachments (message) is intended solely for the use of the 
intended recipient(s) and may contain information that is privileged, 
confidential or proprietary. If you are not an intended recipient, please 
notify the sender, and then please delete and destroy all copies and 
attachments. Please be advised that any review or dissemination of, or the 
taking of any action in reliance on, the information contained in or attached 
to this message is prohibited.
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Printing to a file and a terminal at the same time

2017-10-10 Thread Vail, Rick
I have a script for Cisco devices that will do configuration or any CLI 
command.  What I would like to do is print the output to my terminal(windows) 
and to a file. I can come up with stdout parameters
To print to a file but not to the screen and when I remove the stdout part it 
prints to the screen only.

This prints to a file
filename  = open("outputfile",'w')
sys.stdout = filename
print ("Anything printed will go to the output file")

Remove the above and it prints to the terminal, help



Rick Vail | Network Engineer
Presidio (NASDAQ: PSDO) | www.presidio.com
12272 Hancock St, Carmel, IN 46032
D: 317.428.6399 | C: 317.847.0493 | 
rv...@presidio.com



[Future. Built.]


Follow us:

[Follow Presidio on Twitter]





This message w/attachments (message) is intended solely for the use of the 
intended recipient(s) and may contain information that is privileged, 
confidential or proprietary. If you are not an intended recipient, please 
notify the sender, and then please delete and destroy all copies and 
attachments. Please be advised that any review or dissemination of, or the 
taking of any action in reliance on, the information contained in or attached 
to this message is prohibited.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31753] Unnecessary closure in ast.literal_eval

2017-10-10 Thread Aaron Hall

New submission from Aaron Hall :

Removing the closure seems to make the function about 10% faster.

Original source code at: 
https://github.com/python/cpython/blob/3.6/Lib/ast.py#L40

Empirical evidence: astle.py

import timeit
from ast import literal_eval as orig_literal_eval
from ast import *

def new_literal_eval(node_or_string):
"""
Safely evaluate an expression node or a string containing a Python
expression.  The string or node provided may only consist of the following
Python literal structures: strings, bytes, numbers, tuples, lists, dicts,
sets, booleans, and None.
"""
if isinstance(node_or_string, str):
node_or_string = parse(node_or_string, mode='eval')
if isinstance(node_or_string, Expression):
node_or_string = node_or_string.body
node = node_or_string
if isinstance(node, Constant):
return node.value
elif isinstance(node, (Str, Bytes)):
return node.s
elif isinstance(node, Num):
return node.n
elif isinstance(node, Tuple):
return tuple(map(_convert, node.elts))
elif isinstance(node, List):
return list(map(_convert, node.elts))
elif isinstance(node, Set):
return set(map(_convert, node.elts))
elif isinstance(node, Dict):
return dict((_convert(k), _convert(v)) for k, v
in zip(node.keys, node.values))
elif isinstance(node, NameConstant):
return node.value
elif isinstance(node, UnaryOp) and isinstance(node.op, (UAdd, USub)):
operand = _convert(node.operand)
if isinstance(operand, _NUM_TYPES):
if isinstance(node.op, UAdd):
return + operand
else:
return - operand
elif isinstance(node, BinOp) and isinstance(node.op, (Add, Sub)):
left = _convert(node.left)
right = _convert(node.right)
if isinstance(left, _NUM_TYPES) and isinstance(right, _NUM_TYPES):
if isinstance(node.op, Add):
return left + right
else:
return left - right
raise ValueError('malformed node or string: ' + repr(node))



def main():
print('orig first, then new')
print("'1.01'")
print(min(timeit.repeat(lambda: orig_literal_eval('1.01'
print(min(timeit.repeat(lambda: new_literal_eval('1.01'
print("""'"1.01"'""")
print(min(timeit.repeat(lambda: orig_literal_eval('"1.01"'
print(min(timeit.repeat(lambda: new_literal_eval('"1.01"'
print("'1'")
print(min(timeit.repeat(lambda: orig_literal_eval('1'
print(min(timeit.repeat(lambda: new_literal_eval('1'


if __name__ == '__main__':
main()

Shell:

$ python -m astle
orig first, then new
'1.01'
3.518230145502848
3.274753015923377
'"1.01"'
3.189016693752965
2.906869704238048
'1'
3.40557457956146
3.157061471625788

--
components: Library (Lib)
messages: 304089
nosy: Aaron Hall
priority: normal
severity: normal
status: open
title: Unnecessary closure in ast.literal_eval
type: performance

___
Python tracker 

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



[issue31537] Bug in readline module documentation example

2017-10-10 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +3923

___
Python tracker 

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



[issue31537] Bug in readline module documentation example

2017-10-10 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset eeb5ffd54e56dd89a99c74eb512c36d62649cfec by Mariatta (Brad Smith) 
in branch 'master':
bpo-31537: Update readline documentation example. (GH-3925)
https://github.com/python/cpython/commit/eeb5ffd54e56dd89a99c74eb512c36d62649cfec


--
nosy: +Mariatta

___
Python tracker 

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



[issue31728] crashes in _elementtree due to unsafe decrefs of Element.text and Element.tail

2017-10-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset a8ac71d15f2a4aef83a8954a678cc12545ce517c by Serhiy Storchaka 
(Miss Islington (bot)) in branch '3.6':
[3.6] bpo-31728: Prevent crashes in _elementtree due to unsafe cleanup of 
Element.text and Element.tail (GH-3924) (#3945)
https://github.com/python/cpython/commit/a8ac71d15f2a4aef83a8954a678cc12545ce517c


--

___
Python tracker 

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



[issue31752] Assertion failure in timedelta() in case of bad __divmod__

2017-10-10 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
pull_requests: +3922

___
Python tracker 

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



[issue31746] crashes in sqlite3.Connection in case it is uninitialized or partially initialized

2017-10-10 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



[issue31751] Support for C++ 11 and/or C++ 14 in python.org installer

2017-10-10 Thread Ned Deily

Ned Deily  added the comment:

Can you give a test case demonstrating what is not working?  The Python 
interpreters installed with python.org 10.6+ installers are built to work with 
all versions of macOS from 10.6 on and should be able to build extension 
modules with either gcc or clang as provided by the Xcode or Command Line Tools 
appropriate for the macOS version in use.  And, AFAIK, Python itself has no 
dependency on C++ at all so there should not be a c++ runtime library conflict 
due to Python itself.  Although the initial value of the configuration 
variables are CC=gcc-4.2 and GXX=g++-4.2, when the first compilation of an 
extension module is attempted, Distutils via Lib/_osx_support.py will do some 
work to figure out what compilers are available and modify CC and CXX 
accordingly.  So, for example, on say a macOS 10.13 system with the default 
Command Line Tools, it should use gcc and g++ which are both aliases for clang. 
 And, if necessary, you can always override the default compiler selection by 
explicitly 
 setting the CC and/or CXX environment variables when invoking python.  At 
least that's how it's supposed to work!

--

___
Python tracker 

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



[issue31749] Request: Human readable byte amounts in the standard library

2017-10-10 Thread Rich

Rich  added the comment:

Yep, as I mentioned, it should be configurable to use either format. 
Localization is an excellent point as well, so, all in all, the optional 
arguments to the function are format, significant digits, and delimiter. That's 
not an unreasonable amount of configurability.

It's not a complex problem, the solutions are fairly simple, but there are many 
ways to shoot yourself in the foot when rolling your own. There are already 
many packages which attempt this, most of which aren't used by any serious 
projects, who instead use their own implementations. There are just as many 
snippets of partial solutions floating around the internet as well. There is no 
canonical way to solve this common problem.

This is exactly why this common functionality should be added to the standard 
library, so that this extremely common function doesn't have to be imported 
from some-random-jamook's-untrustworthy-project-on-PyPI or rewritten from 
scratch for every project.

--

___
Python tracker 

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



[issue31752] Assertion failure in timedelta() in case of bad __divmod__

2017-10-10 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

The following code causes an assertion error in timedelta constructor.

from datetime import timedelta

class BadInt(int):
def __mul__(self, other):
return Prod()

class Prod:
def __radd__(self, other):
return Sum()

class Sum:
def __divmod__(self, other):
return (0, -1)

timedelta(hours=BadInt(1))


Result:

python: /home/serhiy/py/cpython/Modules/_datetimemodule.c:1573: 
microseconds_to_delta_ex: Assertion `0 <= temp && temp < 100' failed.
Aborted (core dumped)

--
components: Extension Modules
messages: 304083
nosy: Oren Milman, belopolsky, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Assertion failure in timedelta() in case of bad __divmod__
type: crash
versions: Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

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



[issue31748] configure fails to detect fchdir() using CFLAGS="-Werror -Wall"

2017-10-10 Thread STINNER Victor

STINNER Victor  added the comment:

Python 2.7 is also affected by the issue.

--
versions: +Python 2.7, 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



[issue31748] configure fails to detect fchdir() using CFLAGS="-Werror -Wall"

2017-10-10 Thread STINNER Victor

STINNER Victor  added the comment:

I can reproduce the issue on Fedora 26:

haypo@selma$ ./configure CFLAGS="-Werror -Wall" 2>&1|tee log
haypo@selma$ grep fchdir log
checking for fchdir... no

The problem is not posixmodule.c. The problem is configure which emits a 
compiler warning.

configure.ac contains:
---
AC_MSG_CHECKING(for fchdir)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[void 
*x=fchdir]])],
  [AC_DEFINE(HAVE_FCHDIR, 1, Define if you have the 'fchdir' function.)
   AC_MSG_RESULT(yes)],
  [AC_MSG_RESULT(no)
])
---

Extract of config.log, without the long confdefs.h part:
---
configure:11258: checking for fchdir
configure:11271: gcc -c -Werror -Wall -Wextra  conftest.c >&5
conftest.c: In function 'main':
conftest.c:256:7: error: unused variable 'x' [-Werror=unused-variable]
 void *x=fchdir
   ^
cc1: all warnings being treated as errors
configure:11271: $? = 1
configure: failed program was:
| /* confdefs.h */
| (...)
| /* end confdefs.h.  */
| #include 
| int
| main ()
| {
| void *x=fchdir
|   ;
|   return 0;
| }
configure:11278: result: no
---

--
title: Modules/posixmodule.c: skip compiling jka4NaPmmQ37 and posix_fildes_fd 
-> configure fails to detect fchdir() using CFLAGS="-Werror -Wall"

___
Python tracker 

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



[issue31728] crashes in _elementtree due to unsafe decrefs of Element.text and Element.tail

2017-10-10 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +3919

___
Python tracker 

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



[issue31748] Modules/posixmodule.c: skip compiling jka4NaPmmQ37 and posix_fildes_fd

2017-10-10 Thread Дилян Палаузов

Дилян Палаузов  added the comment:

If I remove -Werror from CFLAGS ./configure prints:

  checking for fchdir... yes
  checking for fsync... yes
  checking for fdatasync... yes

so it is irrelevant what the OS is.

--

___
Python tracker 

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



[issue31728] crashes in _elementtree due to unsafe decrefs of Element.text and Element.tail

2017-10-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 39ecb9c71b6e55d8a61a710d0144231bd88f9ada by Serhiy Storchaka 
(Oren Milman) in branch 'master':
bpo-31728: Prevent crashes in _elementtree due to unsafe cleanup of 
Element.text and Element.tail (#3924)
https://github.com/python/cpython/commit/39ecb9c71b6e55d8a61a710d0144231bd88f9ada


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31750] expose PyCell_Type in types module

2017-10-10 Thread Guido van Rossum

Guido van Rossum  added the comment:

I think the cell type is pretty fundamental to Python's semantic model. IIRC 
there once was a time when cells were entirely hidden from the user, but that's 
no longer true. Third-party code that uses them might want to have type 
annotations and then it's a pain when there's no way to talk about them. And 
no, that doesn't mean it belongs in typing.py -- that's not a scalable model, 
and in general we only want to shadow things there that must be generic (but 
aren't in types.py), like `List` or `re.Pattern`.

--

___
Python tracker 

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



[issue31748] Modules/posixmodule.c: skip compiling jka4NaPmmQ37 and posix_fildes_fd

2017-10-10 Thread STINNER Victor

STINNER Victor  added the comment:

Ok. My next question is: what is your operating system? What is your operating 
system version?

--

___
Python tracker 

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



[issue31749] Request: Human readable byte amounts in the standard library

2017-10-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Do you mean decimal or binary prefixes? 123901842 bytes can be formatted as 
"118.2 MiB". In different areas decimal and binary prefixes can be more common. 
For example the volume of hard disks usually is specified with decimal 
prefixes, but the volume of RAM -- with binary prefixes (32 GiB, not 34.4 GB). 
Sometimes even mixed prefixes can be used (1 MB = 1024000 bytes).

And when we talk about human-readability, we can't ignore localization. For 
many people "123,9 МБ" looks more human-readable than "123.9 MB".

This is a complex problem and needs a complex solution. You can start from 
writing a special purposed package and adding it on PyPI. Maybe there are 
existing packages that solve this problem.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31748] Modules/posixmodule.c: skip compiling jka4NaPmmQ37 and posix_fildes_fd

2017-10-10 Thread Дилян Палаузов

Дилян Палаузов  added the comment:

Having 'CFLAGS="-pipe -Werror -Wall -Wextra -O3 -fno-fat-lto-objects -flto" 
CXXFLAGS="-pipe -Wall -Wextra -O3 -fno-fat-lto-objects -flto" 
LDFLAGS="-Wl,-O1,-s -flto=12" ' in config.site and running "./configure" with 
gcc8 prints:

checking for fchdir... no
checking for fsync... no
checking for fdatasync... no

and config.log has:

configure:11440: checking for fchdir
configure:11453: gcc -c -pipe -Werror -Wall -Wextra -O3 -fno-fat-lto-objects 
-flto  conftest.c >&5
conftest.c: In function 'main':
conftest.c:250:7: error: unused variable 'x' [-Werror=unused-variable]
 void *x=fchdir
   ^
cc1: all warnings being treated as errors
configure:11453: $? = 1
configure: failed program was:
| /* confdefs.h */
...
| #define HAVE_DIRFD 1
| /* end confdefs.h.  */
| #include 
| int
| main ()
| {
| void *x=fchdir
|   ;
|   return 0;
| }
configure:11460: result: no

--

___
Python tracker 

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



[issue31750] expose PyCell_Type in types module

2017-10-10 Thread Devin Bayer

Devin Bayer  added the comment:

Well that's true enough. My main argument is consistency. Cells and code 
objects together make up closures, so to manipulate closures you need both. 
Right now I am using a ctypes hack to modify the cells/closures, for what I 
consider a strategically important use-case. So I guess a type(cell) hack isn't 
out of place; the risk is it's fragile.

So, to really make hot reloading work with no hacks I need both this and the 
follow-up of https://bugs.python.org/issue14369 to be implemented. Or 
equivalently, a python interface to make closures mutable.

Honestly I don't know what your criteria are, so it's hard to make a point.

--

___
Python tracker 

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



[issue31748] Modules/posixmodule.c: skip compiling jka4NaPmmQ37 and posix_fildes_fd

2017-10-10 Thread STINNER Victor

STINNER Victor  added the comment:

Hi Дилян Палаузов,

> These are needed only sometimes.

Would you mind to elaborate, please?

Which platform doesn't have os.fchdir(), os.fsync() nor os.fdatasync()?

--
nosy: +haypo

___
Python tracker 

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



[issue31740] refleaks when calling sqlite3.Connection.__init__() more than once

2017-10-10 Thread STINNER Victor

STINNER Victor  added the comment:

Oren Milman: thanks for your contribution! I merged your PR.

I don't consider that such corner case requires to backport the change to 
Python 2.7 and 3.6.

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



[issue31740] refleaks when calling sqlite3.Connection.__init__() more than once

2017-10-10 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 93c5a5df8ea118f6e4a153a7c8cccd65a5ff8bff by Victor Stinner (Oren 
Milman) in branch 'master':
bpo-31740: Prevent refleaks when sqlite3.Connection.__init__() is called more 
than once (GH-3944)
https://github.com/python/cpython/commit/93c5a5df8ea118f6e4a153a7c8cccd65a5ff8bff


--
nosy: +haypo

___
Python tracker 

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



[issue31749] Request: Human readable byte amounts in the standard library

2017-10-10 Thread Timothy Allen

Timothy Allen  added the comment:

This would be a benefit to my team, for sure. I can't even tell you how many 
different solutions we currently use to make file sizes human readable - at 
least three.

--
nosy: +FlipperPA

___
Python tracker 

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



[issue31750] expose PyCell_Type in types module

2017-10-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The reason is that nobody provided good enough arguments for exposing a cell 
type in the types module. The initial argument "types should expose all types 
used by the interpreter" was found to be bad. There are a lot of types (like 
"stderrprinter" or "list_reverseiterator") that shouldn't be exposed.

--
nosy: +benjamin.peterson, gvanrossum

___
Python tracker 

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



[issue31722] _io.IncrementalNewlineDecoder doesn't inherit codecs.IncrementalDecoder

2017-10-10 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests:  -3918

___
Python tracker 

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



[issue31722] _io.IncrementalNewlineDecoder doesn't inherit codecs.IncrementalDecoder

2017-10-10 Thread Oren Milman

Change by Oren Milman :


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

___
Python tracker 

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



[issue31751] Support for C++ 11 and/or C++ 14 in python.org installer

2017-10-10 Thread steven Michalske

New submission from steven Michalske :

We are using some compiled cython modules with c++ 11 features.
This prohibits us from instructing users to install python from the python.org 
download.

Please consider using clang with support for C++ 11 and higher.
This would move the minimum OS X version away from 10.6 but as 10.6 is 8 years 
old and phased out 6 years ago it should be rare that non technical users would 
be using this OS version.

--
components: Build, Installation, macOS
messages: 304068
nosy: hardkrash, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Support for C++ 11 and/or C++ 14 in python.org installer
type: enhancement
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



[issue31750] expose PyCell_Type in types module

2017-10-10 Thread Devin Bayer

Devin Bayer  added the comment:

I have just reread those discussions and I don't see any reasoning behind 
omitting the cell type. It is barely mentioned.

Basically, I need this type and it isn't exposed anywhere. I don't care where 
it is, but the only way to get it right now is a hack, for example:

a = [1]
def f(): return a
return type(f.__closure__[0])

--

___
Python tracker 

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



[issue31738] Lib/site.py: method `abs_paths` is not documented

2017-10-10 Thread Liel Fridman

Liel Fridman  added the comment:

No, I've just tried to find something to work on as a first contribution.

--

___
Python tracker 

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



[issue31749] Request: Human readable byte amounts in the standard library

2017-10-10 Thread Michael DePalatis

Michael DePalatis  added the comment:

This would be a useful feature, but I don't think it quite fits in the math 
package. It might make more sense to use this with string formatting, for 
example:

{:h}.format(filesize)

where I use h as the format specifier since it doesn't appear to be taken yet 
and would be in line with "human-readable" options in tools like ls.

--
nosy: +mivade

___
Python tracker 

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



[issue13601] sys.stderr should be line-buffered when stderr is not a TTY

2017-10-10 Thread Torsten Landschoff

Torsten Landschoff  added the comment:

> Looking at 
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/stdin.html (which 
> also covers stdout and stderr), it specifically says about stderr: "When 
> opened, the standard error stream is not fully buffered;".

I was of the impression that this is defined in ISO C already. Unfortunately, I 
only have ISO C 99 at hand, but this clearly states in section 7.19.3 (Files), 
enumeration item 7:

> As initially opened,  the  standard  error  stream  is  not  fully  buffered; 
>  the  standard  input  and  standard output streams are fully buffered if and 
> only if the stream can be determined not to refer
to an interactive device.

I am quite sure this is just as as it was in the original ANSI C standard.

--
nosy: +torsten

___
Python tracker 

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



[issue31750] expose PyCell_Type in types module

2017-10-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

According to discussions in the issues referred by you, this omission is 
intentional. Do you have any new arguments for adding the cell type in the 
types module?

--
nosy: +serhiy.storchaka
versions: +Python 3.7 -Python 3.6

___
Python tracker 

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



[issue31750] expose PyCell_Type in types module

2017-10-10 Thread Devin Bayer

New submission from Devin Bayer :

The type of PyCell_Type is not available in the types module or anywhere else. 
Since this type is exposed to users it seems like it's a rather odd omission.

Related issues:
- https://bugs.python.org/issue2408
- https://bugs.python.org/issue1605

--
components: Library (Lib)
messages: 304062
nosy: akvadrako
priority: normal
severity: normal
status: open
title: expose PyCell_Type in types module
type: enhancement
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: about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread Ned Batchelder

On 10/10/17 11:00 AM, Stefan Ram wrote:

xieyuheng  writes:

1. 'setattr(o, name, value)' can be used for what kind of objects ?

   It takes three objects as arguments.

   The first object should have an attribute named by the value
   of »name« that should allow this attribute to be set to
   »value« as if by

o.=value

   where  is the value of »name« (which should be a string).



One tweak to this: the object doesn't need to have the attribute 
initially.  setattr() can create new attributes that don't already exist.


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


[issue31749] Request: Human readable byte amounts in the standard library

2017-10-10 Thread Rich

New submission from Rich :

This problem is an _extremely_ common one, a problem that almost any Python 
project of a reasonable size will encounter.

Given a number of bytes, say 123901842, format this as '123.9MB'.

The reason I strongly think that this should be included in the standard 
library is that if you look for how to do this through a Google search, there 
are an incredible amount of different solutions on StackOverflow, blog posts, 
forum posts, and various different libraries which provide this functionality - 
with varying levels of functionality and safety. You can also find different 
implementations of solutions to this problem inside of pretty much every major 
Python project (Django, etc.). In fact, I don't think I can think of any other 
function that gets copy-pasted into a project's 'util.py' file more commonly.

I think this should functionality should be provided in the standard math 
package, with arguments which allow to specific SI/NIST formatting and the 
number of significant digits to display. Implementing this would strongly cut 
down on the amount of cargo-cult Python programming in the world.

I'm willing to implement this if there's a consensus that it should be included.

Thanks!,
Rich Jones

--
messages: 304061
nosy: miserlou2
priority: normal
severity: normal
status: open
title: Request: Human readable byte amounts in the standard library
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



[issue6135] subprocess seems to use local encoding and give no choice

2017-10-10 Thread Steve Dower

Steve Dower  added the comment:

> The commit for this bug (720f0cf580e2) introduces encoding and errors 
> arguments but doesn't actually document what the values of these should be

Do you mean it doesn't document that they take the normal encoding/errors 
arguments that all the other functions that do character encoding take? Or they 
don't specify which encoding you should use? The latter is not feasible, and if 
you mean the former then feel free to open a new issue for documentation.

Having a single "text" parameter is essentially what we had before - a magic 
option that modifies your data without giving you any ability to do it 
correctly. This change brought Popen in line with all the other places where we 
translate OS-level bytes into Python str, and it's done it in exactly the same 
way.

Also see msg274562 where Nick withdraws his own suggestion of a "text" 
parameter.

--

___
Python tracker 

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



[issue31748] Modules/posixmodule.c: skip compiling jka4NaPmmQ37 and posix_fildes_fd

2017-10-10 Thread Дилян Палаузов

New submission from Дилян Палаузов :

These are needed only sometimes.

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1466,6 +1466,7 @@ path_error2(path_t *path, path_t *path2)
 
 /* POSIX generic methods */
 
+#if defined(HAVE_FSYNC) || defined(HAVE_FDATASYNC) || defined(HAVE_FCHDIR)
 static int
 fildes_converter(PyObject *o, void *p)
 {
@@ -1495,6 +1496,7 @@ posix_fildes_fd(int fd, int (*func)(int))
 return (!async_err) ? posix_error() : NULL;
 Py_RETURN_NONE;
 }
+#endif
 
 
 #ifdef MS_WINDOWS

--
components: Build
messages: 304059
nosy: dilyan.palauzov
priority: normal
severity: normal
status: open
title: Modules/posixmodule.c: skip compiling jka4NaPmmQ37 and posix_fildes_fd
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



[issue31747] fatal error LNK1120 in PCbuild\python3dll.vcxproj

2017-10-10 Thread Denis Osipov

Denis Osipov  added the comment:

Oops... I've tried to rebuild, it didn't help. But after deleting folder 
cpython\PCbuild\amd64 everything works well again.

Sorry for false alarm.

--
resolution:  -> works for me
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue1927] Change input() to always prompt to stderr

2017-10-10 Thread Carvell Scott

Change by Carvell Scott :


--
nosy: +Carvell Scott

___
Python tracker 

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



[issue31733] [2.7] Add PYTHONSHOWREFCOUNT environment variable to Python 2.7

2017-10-10 Thread Charalampos Stratakis

Change by Charalampos Stratakis :


--
nosy: +cstratak

___
Python tracker 

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



Re: about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread Thomas Jollans
On 2017-10-10 16:37, xieyuheng wrote:
>> Some callables may not be introspectable in certain implementations of 
> Python.
>> For example, in CPython, some built-in functions defined in C
>> provide no metadata about their arguments.
> 
>this is depends on implementation, so I ask for CPython.

There's not really much more to say than what the docs you're quoting say.

As far as I'm aware, all callables defined in Python will have a
signature, while the default for "built-in" functions (anything written
in C) in CPython is for them not to have a signature. This applies to
__builtins__ and other modules written in C equally.

In __builtins__, most callables have NO signature as of Python 3.6.
However, around 3/4 of the *functions* there (i.e. not types) DO have
signatures. In particular none of the built-in exceptions have signatures.

>>> import inspect
>>> no_sig = []
>>> has_sig = []
>>> for name, val in __builtins__.__dict__.items():
... try:
... tmp = inspect.signature(val)
... except TypeError:
... pass # not callable
... except ValueError:
... no_sig.append(name)
... else:
... has_sig.append(name)
...
>>>
>>> len(no_sig)
101
>>> len(has_sig)
40

Look at only "functions":

>>> [name for name in no_sig if type(getattr(__builtins__, name)) ==
type(print)]
['__build_class__', '__import__', 'dir', 'getattr', 'iter', 'max',
'min', 'next', 'print', 'round', 'vars']
>>> len([name for name in no_sig if type(getattr(__builtins__, name)) ==
type(print)])
11
>>> [name for name in has_sig if type(getattr(__builtins__, name)) ==
type(print)]
['abs', 'all', 'any', 'ascii', 'bin', 'callable', 'chr', 'compile',
'delattr', 'divmod', 'eval', 'exec', 'format', 'globals', 'hasattr',
'hash', 'hex', 'id', 'input', 'isinstance', 'issubclass', 'len',
'locals', 'oct', 'ord', 'pow', 'repr', 'setattr', 'sorted', 'sum', 'open']
>>> len([name for name in has_sig if type(getattr(__builtins__, name))
== type(print)])
31

Take out the exceptions and warnings:

>>> [name for name in no_sig if name[0] == name[0].lower()]
['__build_class__', '__import__', 'dir', 'getattr', 'iter', 'max',
'min', 'next', 'print', 'round', 'vars', 'bool', 'bytearray', 'bytes',
'classmethod', 'complex', 'dict', 'enumerate', 'filter', 'float',
'frozenset', 'property', 'int', 'list', 'map', 'range', 'reversed',
'set', 'slice', 'staticmethod', 'str', 'super', 'tuple', 'type', 'zip']
>>> len([name for name in no_sig if name[0] == name[0].lower()])
35
>>> [name for name in has_sig if name[0] == name[0].lower()]
['__loader__', 'abs', 'all', 'any', 'ascii', 'bin', 'callable', 'chr',
'compile', 'delattr', 'divmod', 'eval', 'exec', 'format', 'globals',
'hasattr', 'hash', 'hex', 'id', 'input', 'isinstance', 'issubclass',
'len', 'locals', 'oct', 'ord', 'pow', 'repr', 'setattr', 'sorted',
'sum', 'memoryview', 'object', 'open', 'quit', 'exit', 'copyright',
'credits', 'license', 'help']
>>> len([name for name in has_sig if name[0] == name[0].lower()])
40
>>>


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


[issue31742] Default to emitting FutureWarning for provisional APIs

2017-10-10 Thread Donald Stufft

Donald Stufft  added the comment:

> What happened to "consenting adults"?

Making sure they're actually consenting when getting into something that might 
potentially bite them in the ass seems like a sane and thoughtful thing to do 
to me.

--

___
Python tracker 

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



Re: about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread Terry Reedy

On 10/10/2017 10:37 AM, xieyuheng wrote:


2. what kind of functions does not have signature,
so that 'inspect.signature(f)' can be used for them ?


When .signature was added, it may not have been usable with *any* 
C-coded function.  About the same, a mechanism was added to make 
signatures available with C-coded functions.  Using the mechanism 
requires recoding for each file.  By now, many CPython functions have 
been recoded.



section '29.12.3. Introspecting callables with the Signature object'
of the official documentation says :

> Some callables may not be introspectable in certain implementations of 
Python.


So 'some' is a gradually shrinking set.


> For example, in CPython, some built-in functions defined in C
> provide no metadata about their arguments.

this is depends on implementation, so I ask for CPython.


--
Terry Jan Reedy

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


Keyboard Input [was: The "loop and a half"]

2017-10-10 Thread Mikhail V
Chris Angelico wrote:

> On Mon, Oct 9, 2017 at 7:05 PM, Mikhail V  wrote:
> > The first thing a developer should provide - the keys and mouse input
> > should be
> > *customizable* by the user. It is so by most serious application I have
> > ever used.
>
> And they most certainly are. Often, in something in the host platform.
> For instance, Xfce allows me to change the keys used for various
> purposes, by going into the menu and choosing "Settings" and then
> "Keyboard". (Or, of course, by editing the config files.) The most
> obvious and dramatic change you can do is to choose a specific
> keyboard layout - Qwerty vs Dvorak, US vs German, etc, etc, etc. Do
> you think that sort of thing should be in the hands of the
> application, or the platform? (Note that I'm not saying "OS" here.
> Usually the platform is at a higher level than that; in my case, I
> would consider Xfce (my desktop manager) to be that.)


I am not sure I correctly understand your question.
Do you ask whether the application should bypass the OS
selected layout and use own character input tables?
It is of course possible, but since the OS provides
input events, why not use those?
We were speaking about a text editor, so yes this
will be useful if one wants multilingual text input.

Also I am almost sure I can programmatically switch
the layout pages from Python (some Winapi calls I suppose)
So theoretically, based only on keyb scancodes, one
can use own LUTS and flags to replicate the unicode
input. I personally never wrote apps with multilingual text input though.

Seems that for keyboard input everything is already invented and
well-established.
Below is a minimal app showing pressed keys.
Try switching layouts and see 'unicode'  field changing for
same key scancode.


import pygame
pygame.init()
window_w = 300# display width
window_h = 200# display height
pygame.display.set_mode((window_w, window_h))
clock = pygame.time.Clock( )
FPS = 15
MainLoop = True
while MainLoop :
clock.tick(FPS)
for E in pygame.event.get():
if E.type == pygame.QUIT:
MainLoop = False
if E.type == pygame.KEYDOWN:
print (E)
if E.key == pygame.K_ESCAPE:
MainLoop = False
pygame.quit( )




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


[issue14369] make __closure__ writable

2017-10-10 Thread Devin Bayer

Devin Bayer  added the comment:

Any updates on this? I'm trying to implement hot module reloading using code 
from IPython, which tries to modify __closure__ in place. It fails silently and 
doesn't work, but indeed would be nice to have.

--

___
Python tracker 

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



[issue31742] Default to emitting FutureWarning for provisional APIs

2017-10-10 Thread Guido van Rossum

Guido van Rossum  added the comment:

I have no bandwidth for this discussion, but so far I am not convinced. What 
happened to "consenting adults"?

> [...] the entire point of the proposed warning letting people know that they 
> may be using something they are not fully educated or informed about the 
> ramifications of using

That describes most of the Python experience. :-)

I think you all should lighten up. It really sounds like a classic case of 
someone who was bitten badly by some obscure aspect of an API and then 
overreacts.

If the warning in the docs does not grab enough attention, change the text or 
formatting of that warning.

--

___
Python tracker 

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



[issue14369] make __closure__ writable

2017-10-10 Thread Devin Bayer

Change by Devin Bayer :


--
nosy: +akvadrako

___
Python tracker 

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



[issue31314] email throws exception with oversized header input

2017-10-10 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

PR 3938 fixes this issue, but I'm wondering why self._split() returns an empty 
list only for long header names.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue31672] string.Template should use re.ASCII flag

2017-10-10 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

With some comments to clarify of course.

--

___
Python tracker 

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



[issue31672] string.Template should use re.ASCII flag

2017-10-10 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Oct 6, 2017, at 15:04, Serhiy Storchaka  wrote:
> Serhiy Storchaka  added the comment:
> 
> Another solution (works in 3.6 too): set idpattern to 
> r'(?-i:[_a-zA-Z][_a-zA-Z0-9]*)'.
> 
> This looks pretty weird, setting the re.IGNORECASE flag and then unsetting 
> it. But it works, and don't break the user code that changes idpattern 
> without changing flags.

Oh, I think I like that :)

--

___
Python tracker 

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



Re: Python GUI application embedding a web browser - Options?

2017-10-10 Thread Paul Moore
On 10 October 2017 at 16:07, oliver  wrote:
> Can you elaborate what is not sufficient with Qt's web components?

I can't, sorry. Douglas was resurrecting a thread from a year ago. At
the time I was trying to do a quick proof of concept project and asked
for help on here. The project never really went anywhere, because it
ended up being more complex than I had time for. I don't recall the
details any more.

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


Re: about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread Paul Moore
On 10 October 2017 at 15:37, xieyuheng  wrote:
> 1. 'setattr(o, name, value)' can be used for what kind of objects ?
>
>section '2. Built-in Functions'
>of the official documentation says :
>
>> The function assigns the value to the attribute, provided the object 
> allows it.

Anything for which o. = value will work. However, user defined
types can choose to raise an exception if you try to assign to certain
attributes, types with slots will raise an exception if you try to
assign to an attribute not defined in __slots__, etc.

These are all run-time behaviours, and so there's no way you can check
for them ahead of time. If you want to be sure setattr is allowed, you
need to handle possible exceptions:

try:
setattr(o, name, value)
except Exception:
# deal with the problem

Example:

>>> class C:
... __slots__ = ['a', 'b']
...
>>> c = C()
>>> c.c = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'C' object has no attribute 'c'
>>> setattr(c, 'c', 1)
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'C' object has no attribute 'c'
>>> try:
... setattr(c, 'c', 1)
... except AttributeError:
... pass
...
>>>

> 2. what kind of functions does not have signature,
>so that 'inspect.signature(f)' can be used for them ?
>
>section '29.12.3. Introspecting callables with the Signature object'
>of the official documentation says :
>
>> Some callables may not be introspectable in certain implementations of 
> Python.
>> For example, in CPython, some built-in functions defined in C
>> provide no metadata about their arguments.
>
>this is depends on implementation, so I ask for CPython.

Again, it's a runtime issue, so the answer is the same "it's easier to
ask for forgiveness than permission" - try the operation and handle
any exception:

>>> import inspect
>>> inspect.signature(type)
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Users\me\AppData\Local\Programs\Python\Python36\Lib\inspect.py",
line 3033, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  File "C:\Users\me\AppData\Local\Programs\Python\Python36\Lib\inspect.py",
line 2783, in from_callable
follow_wrapper_chains=follow_wrapped)
  File "C:\Users\me\AppData\Local\Programs\Python\Python36\Lib\inspect.py",
line 2262, in _signature_from_callable
skip_bound_arg=skip_bound_arg)
  File "C:\Users\me\AppData\Local\Programs\Python\Python36\Lib\inspect.py",
line 2087, in _signature_from_builtin
raise ValueError("no signature found for builtin
{!r}".format(func))
ValueError: no signature found for builtin 
>>> try:
... sig = inspect.signature(type)
... except ValueError:
... sig = None
...
>>> print(repr(sig))
None

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


Re: Python GUI application embedding a web browser - Options?

2017-10-10 Thread oliver
Can you elaborate what is not sufficient with Qt's web components?
http://doc.qt.io/qt-5/topics-web-content.html. This allows for HTML, CSS,
Javascript, via either native C++ Qt, QML, or Python (PyQt) or mixtures of
these 3. That said, I have not yet used Qt`s web engine so I don`t know how
full-featured it is, how robust, etc. I have used PyQt for several years in
production grade project and it is very solid and well documented and easy
to program with and easy to write tests for.
Oliver

On Mon, 9 Oct 2017 at 12:59 fpp  wrote:

> Paul Moore  said :
>
> > On 9 October 2017 at 04:25,   wrote:
> >> Did you find out the answer for that?
> >
> > Nothing much beyond the pointer to PyQt (which basically said "a lot
> > of the info on the web is out of date" so I should check the latest
> > docs). I didn't take it much further, though, as it was a hobby
> > project and the learning curve for PyQt (any GUI framework, really)
> > was a bit high for the amount of spare time I had at the time.
> >
> > Paul
>
> Have you looked at CEFpython ?
> It seems to work with all major GUIs (Qt, wx, Tk, gtk..)
> https://github.com/cztomczak/cefpython/tree/master/examples
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
Oliver
My StackOverflow contributions
My CodeProject articles
My Github projects
My SourceForget.net projects
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31705] test_sha256 from test_socket fails on ppc64le arch

2017-10-10 Thread Charalampos Stratakis

Charalampos Stratakis  added the comment:

Attaching the output of:

strace -s 128 -e trace=%network -o trace ./python3 -m test -v test_socket -m 
test_sha256

using the latest version of strace (4.19).

--
Added file: https://bugs.python.org/file47204/trace2

___
Python tracker 

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



[issue31747] fatal error LNK1120 in PCbuild\python3dll.vcxproj

2017-10-10 Thread Denis Osipov

New submission from Denis Osipov :

Since today (2017-10-10) I have compile error on Windows 10:

$ PCbuild/build.bat -e -d -p x64
Using py -3.6 (found with py.exe)
Fetching external libraries...
bzip2-1.0.6 already exists, skipping.
sqlite-3.14.2.0 already exists, skipping.
xz-5.2.2 already exists, skipping.
zlib-1.2.11 already exists, skipping.
Fetching external binaries...
openssl-bin-1.1.0f already exists, skipping.
tcltk-8.6.6.0 already exists, skipping.
Finished.
Using "C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\\MSBuild\15.0\Bin\msbuild.exe" (found in the Visual 
Studio 2017 registry)

D:\repos\cpython>"C:\Program Files (x86)\Microsoft Visual 
Studio\2017\Community\\MSBuild\15.0\Bin\msbuild.exe" 
"D:\repos\cpython\PCbuild\pcbuild.proj" /t:Build /m /nologo /v:m 
/p:Configuration=Debug /p:Platform=x64 /p:IncludeExternals=true 
/p:IncludeSSL=true /p:IncludeTkinter=true /p:UseTestMarker= /p:GIT="C:\Program 
Files\Git\mingw64\bin\git.exe"
  Killing any running python_d.exe instances...
  Getting build info from "C:\Program Files\Git\mingw64\bin\git.exe"
  Building heads/master:a997c7b434 master
  pythoncore.vcxproj -> D:\repos\cpython\PCbuild\amd64\python37_d.dll
  pythoncore.vcxproj -> D:\repos\cpython\PCbuild\amd64\python37_d.pdb (Full PDB)
  _ctypes_test.vcxproj -> D:\repos\cpython\PCbuild\amd64\_ctypes_test_d.pyd
  _ctypes_test.vcxproj -> D:\repos\cpython\PCbuild\amd64\_ctypes_test_d.pdb 
(Full PDB)
  _testbuffer.vcxproj -> D:\repos\cpython\PCbuild\amd64\_testbuffer_d.pyd
  _testbuffer.vcxproj -> D:\repos\cpython\PCbuild\amd64\_testbuffer_d.pdb (Full 
PDB)
  _testcapi.vcxproj -> D:\repos\cpython\PCbuild\amd64\_testcapi_d.pyd
  _testcapi.vcxproj -> D:\repos\cpython\PCbuild\amd64\_testcapi_d.pdb (Full PDB)
  _testembed.vcxproj -> D:\repos\cpython\PCbuild\amd64\_testembed_d.exe
  _testembed.vcxproj -> D:\repos\cpython\PCbuild\amd64\_testembed_d.pdb (Full 
PDB)
  _testimportmultiple.vcxproj -> 
D:\repos\cpython\PCbuild\amd64\_testimportmultiple_d.pyd
  _testimportmultiple.vcxproj -> 
D:\repos\cpython\PCbuild\amd64\_testimportmultiple_d.pdb (Full PDB)
  _testmultiphase.vcxproj -> 
D:\repos\cpython\PCbuild\amd64\_testmultiphase_d.pyd
  _testmultiphase.vcxproj -> 
D:\repos\cpython\PCbuild\amd64\_testmultiphase_d.pdb (Full PDB)
  _testconsole.vcxproj -> D:\repos\cpython\PCbuild\amd64\_testconsole_d.pyd
  _testconsole.vcxproj -> D:\repos\cpython\PCbuild\amd64\_testconsole_d.pdb 
(Full PDB)
  pylauncher.vcxproj -> D:\repos\cpython\PCbuild\amd64\py_d.exe
  pylauncher.vcxproj -> D:\repos\cpython\PCbuild\amd64\py_d.pdb (Full PDB)
  pywlauncher.vcxproj -> D:\repos\cpython\PCbuild\amd64\pyw_d.exe
  pywlauncher.vcxproj -> D:\repos\cpython\PCbuild\amd64\pyw_d.pdb (Full PDB)
  pyshellext.vcxproj -> D:\repos\cpython\PCbuild\amd64\pyshellext_d.dll
  pyshellext.vcxproj -> D:\repos\cpython\PCbuild\amd64\pyshellext_d.pdb (Full 
PDB)
 Создается библиотека D:\repos\cpython\PCbuild\amd64\python3_dstub.lib и 
объект D:\repos\cpython\PCbuild\amd64\python3_dstub.exp
  _asyncio.vcxproj -> D:\repos\cpython\PCbuild\amd64\_asyncio_d.pyd
  _asyncio.vcxproj -> D:\repos\cpython\PCbuild\amd64\_asyncio_d.pdb (Full PDB)
  _ctypes.vcxproj -> D:\repos\cpython\PCbuild\amd64\_ctypes_d.pyd
  _ctypes.vcxproj -> D:\repos\cpython\PCbuild\amd64\_ctypes_d.pdb (Full PDB)
  _decimal.vcxproj -> D:\repos\cpython\PCbuild\amd64\_decimal_d.pyd
  _decimal.vcxproj -> D:\repos\cpython\PCbuild\amd64\_decimal_d.pdb (Full PDB)
  LINK : не найден или не выполнена сборка 
D:\repos\cpython\PCbuild\amd64\python3_d.dll при последней инкрементной 
компоновке; выполняется полная компоновка
  _elementtree.vcxproj -> D:\repos\cpython\PCbuild\amd64\_elementtree_d.pyd
  _elementtree.vcxproj -> D:\repos\cpython\PCbuild\amd64\_elementtree_d.pdb 
(Full PDB)
python3_d.def : error LNK2001: неразрешенный внешний символ 
"PyThread_tss_alloc" [D:\repos\cpython\PCbuild\python3dll.vcxproj]
python3_d.def : error LNK2001: неразрешенный внешний символ 
"PyThread_tss_create" [D:\repos\cpython\PCbuild\python3dll.vcxproj]
python3_d.def : error LNK2001: неразрешенный внешний символ 
"PyThread_tss_delete" [D:\repos\cpython\PCbuild\python3dll.vcxproj]
python3_d.def : error LNK2001: неразрешенный внешний символ "PyThread_tss_free" 
[D:\repos\cpython\PCbuild\python3dll.vcxproj]
python3_d.def : error LNK2001: неразрешенный внешний символ "PyThread_tss_get" 
[D:\repos\cpython\PCbuild\python3dll.vcxproj]
python3_d.def : error LNK2001: неразрешенный внешний символ 
"PyThread_tss_is_created" [D:\repos\cpython\PCbuild\python3dll.vcxproj]
python3_d.def : error LNK2001: неразрешенный внешний символ "PyThread_tss_set" 
[D:\repos\cpython\PCbuild\python3dll.vcxproj]
D:\repos\cpython\PCbuild\amd64\python3_d.lib : fatal error LNK1120: 
неразрешенных внешних элементов: 7 [D:\repos\cpython\PCbuild\python3dll.vcxproj]
  _multiprocessing.vcxproj -> 
D:\repos\cpython\PCbuild\amd64\_multiprocessing_d.pyd
  _multiprocessing.vcxproj -> 

[issue6135] subprocess seems to use local encoding and give no choice

2017-10-10 Thread Andrew Clegg

Andrew Clegg  added the comment:

The commit for this bug (720f0cf580e2) introduces encoding and errors arguments 
but doesn't actually document what the values of these should be. In the case 
of the encoding it could be reasonably guessed, but the only way to determine 
what the value of 'errors' should be is to make the logical leap and look at 
the TextIOWrapper doc page.

And in reply to message #274510, there certainly should be a 'text=True' 
argument added. There are countless use cases where text rather than bytes is 
the expected behaviour, and currently this has to be triggered by using a more 
obscure option. In any case, it could be argued that text should be returned 
when shell=True since this mimics the behaviour of any shell program. 

(Sorry if adding a comment to a closed bug is poor etiquette; it seemed like 
the best place to put this comment)

--
nosy: +andrewclegg

___
Python tracker 

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



about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread xieyuheng
in CPython,

instead of trying each object and function,

is there any rules can help me answer the following questions ?

or is there any third part documentations
[community driven docs ? wiki ?]
that can answer them ?

1. 'setattr(o, name, value)' can be used for what kind of objects ?

   section '2. Built-in Functions'
   of the official documentation says :

   > The function assigns the value to the attribute, provided the object 
allows it.

2. what kind of functions does not have signature,
   so that 'inspect.signature(f)' can be used for them ?

   section '29.12.3. Introspecting callables with the Signature object'
   of the official documentation says :

   > Some callables may not be introspectable in certain implementations of 
Python.
   > For example, in CPython, some built-in functions defined in C
   > provide no metadata about their arguments.

   this is depends on implementation, so I ask for CPython.

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


about 'setattr(o, name, value)' and 'inspect.signature(f)'

2017-10-10 Thread xieyuheng
in CPython,

instead of trying each object and function,

is there any rules can help me answer the following questions ?

or is there any third part documentations
[community driven docs ? wiki ?]
that can answer them ?

1. 'setattr(o, name, value)' can be used for what kind of objects ?

   section '2. Built-in Functions'
   of the official documentation says :

   > The function assigns the value to the attribute, provided the object 
allows it.

2. what kind of functions does not have signature,
   so that 'inspect.signature(f)' can be used for them ?

   section '29.12.3. Introspecting callables with the Signature object'
   of the official documentation says :

   > Some callables may not be introspectable in certain implementations of 
Python.
   > For example, in CPython, some built-in functions defined in C
   > provide no metadata about their arguments.

   this is depends on implementation, so I ask for CPython.

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


[issue31740] refleaks when calling sqlite3.Connection.__init__() more than once

2017-10-10 Thread Oren Milman

Oren Milman  added the comment:

(opened bpo-31746 for the crashes i mentioned)

--

___
Python tracker 

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



[issue31746] crashes in sqlite3.Connection in case it is uninitialized or partially initialized

2017-10-10 Thread Oren Milman

New submission from Oren Milman :

The following code causes a crash:
import sqlite3
connection = sqlite3.Connection.__new__(sqlite3.Connection)
connection.isolation_level

This is because pysqlite_connection_get_isolation_level() doesn't check whether
the Connection object is initialized.
pysqlite_connection_close() also doesn't check that, so we would get a crash
also if we replaced `connection.isolation_level` with `connection.close()`.

pysqlite_connection_set_isolation_level() doesn't crash in case of an
uninitialized Connection object, but it also doesn't raise an error, and IMHO
it should.


The following code causes a crash, too:
import sqlite3
try:
connection = sqlite3.Connection.__new__(sqlite3.Connection)
connection.__init__('', isolation_level='invalid isolation level')
except ValueError:
pass

connection.cursor()

This is because `self->initialized` is set to 1 in the beginning of
pysqlite_connection_init(), so after it fails, we are left with a partially
initialized Connection object whose `self->initialized` is 1. Thus,
pysqlite_connection_cursor() thinks that the Connection object is initialized.
Eventually pysqlite_connection_register_cursor() is called, and it crashes
while trying to append to `connection->cursors`, which is NULL.

--
components: Extension Modules
messages: 304047
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: crashes in sqlite3.Connection in case it is uninitialized or partially 
initialized
type: crash
versions: Python 3.7

___
Python tracker 

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



[issue31740] refleaks when calling sqlite3.Connection.__init__() more than once

2017-10-10 Thread Oren Milman

Change by Oren Milman :


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

___
Python tracker 

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



[issue31744] Python 2.7.14 Fails to compile on CentOS/RHEL7

2017-10-10 Thread Ned Deily

Change by Ned Deily :


--
nosy: +ishcherb

___
Python tracker 

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



[issue31744] Python 2.7.14 Fails to compile on CentOS/RHEL7

2017-10-10 Thread Ned Deily

Ned Deily  added the comment:

Do you already have an existing version of Python 2.7 installed at the prefix 
location /opt/ws1?  Because you are attempting to build with --enable-shared, 
the build may be picking up the already installed shared library.  Try building 
without --enable-shared or with a unique prefix location and see if it works 
then.

--
nosy: +ned.deily -ishcherb

___
Python tracker 

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



[issue31744] Python 2.7.14 Fails to compile on CentOS/RHEL7

2017-10-10 Thread Iryna Shcherbina

Change by Iryna Shcherbina :


--
nosy: +ishcherb

___
Python tracker 

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



[issue31745] Overloading "Py_GetPath" does not work

2017-10-10 Thread Kay Hayen

New submission from Kay Hayen :

Hello,

for my Python compiler Nuitka, I want to make sure that compiled binaries in 
standalone mode do not access the original installation, but solely the 
distribution folder created.

I am using the new API Py_SetPath on Python3 and it works fine. The Python2.7 
documentation of the C-API however says: 

The embedding application can steer the search by calling 
Py_SetProgramName(file) before calling Py_Initialize(). Note that PYTHONHOME 
still overrides this and PYTHONPATH is still inserted in front of the standard 
path. An application that requires total control has to provide its own 
implementation of Py_GetPath(), Py_GetPrefix(), Py_GetExecPrefix(), and 
Py_GetProgramFullPath() (all defined in Modules/getpath.c).

My attempts at overloading this have badly failed, because of conflicting 
"declspec" (dllimport vs dllexport). And when defining Py_GetPath away before 
making the include, so the conflict is not seen by the MSVC compiler, the 
result is that the function is not called. 
Is this known to work? Can you point me to a working example, because my 
searches didn't reveal anything. Not normal web search, nor global code search 
for Py_GetPath code.

I did not try on Linux yet. I am assuming it might work, I just wanted to tap 
on knowledge on your side. Is it feasible. For Linux? For Windows?

Thanks,
Kay Hayen

--
components: Build
messages: 304045
nosy: kayhayen
priority: normal
severity: normal
status: open
title: Overloading "Py_GetPath" does not work
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue31705] test_sha256 from test_socket fails on ppc64le arch

2017-10-10 Thread Charalampos Stratakis

Charalampos Stratakis  added the comment:

Indeed the version of strace is 'strace-4.12-4.el7'.

I will try to provide output from the latest one.

--

___
Python tracker 

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



Re: pathlib PurePosixPath

2017-10-10 Thread eryk sun
On Tue, Oct 10, 2017 at 11:18 AM, Tim Golden  wrote:
> On 2017-10-10 10:58, Chris Angelico wrote:
>> On Tue, Oct 10, 2017 at 8:56 PM, Tim Golden  wrote:
>>
>>> In fact its presence in that filename creates a (usually hidden) data
>>> stream piggybacked onto that file which has the name "abc" into which the
>>> data is written.
>>>
>>> So, following on, the follow works:
>>>
>>> assert open("temp.txt:abc").read() == "abc"
>>
>> Cool. Does it require that temp.txt exist first? And if you have
>> multiple colons (as in the OP's), does the part after the second colon
>> have to be a type indicator?
>>
>> ChrisA
>
> No. temp.txt is created empty.
>
> Multiple colons *does* appear to be a syntax error in the filename.

Colon in a file path (not a device name) is a reserved character
that's used to reference NTFS file streams. The colon is not part of
the name of either the base file/directory or the stream. You can
check whether a volume supports named streams by calling
GetVolumeInformation. If they're supported, then lpFileSystemFlags
will contain the flag FILE_NAMED_STREAMS.

The complete spec is "FileName:StreamName:StreamType". When a regular
file is opened, NTFS defaults to opening the anonymous data stream,
"FileName::$DATA". When a directory is opened, NTFS defaults to
opening "DirName:$I30:$INDEX_ALLOCATION", i.e. the $I30 stream of type
$INDEX_ALLOCATION. A directory can also have named $DATA streams, but
it can't have an anonymous $DATA stream because that would be
ambiguous in general.

Other stream types used internally in NTFS include $FILE_NAME,
$REPARSE_POINT, $OBJECT_ID, $ATTRIBUTE_LIST, $INDEX_ROOT, and $BITMAP.
But these are of little interest unless you specialize in forensics or
are supporting NTFS on another OS.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue31744] Python 2.7.14 Fails to compile on CentOS/RHEL7

2017-10-10 Thread Charalampos Stratakis

Charalampos Stratakis  added the comment:

Which CentOS/RHEL version do you have?

Could you provide the output of 'cat /etc/redhat-release' ?

--
nosy: +cstratak

___
Python tracker 

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



  1   2   >