[issue29274] Change “tests cases” → “test cases”

2017-01-13 Thread Martin Panter

New submission from Martin Panter:

The “unittest” documentation has “tests cases” written a few times. This 
doesn’t seem right to me, but I thought I should get a second opinion in case I 
missed something.

--
assignee: docs@python
components: Documentation
files: tests-cases.patch
keywords: patch
messages: 285468
nosy: docs@python, martin.panter
priority: normal
severity: normal
stage: patch review
status: open
title: Change “tests cases” → “test cases”
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46288/tests-cases.patch

___
Python tracker 

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



[issue1621] Do not assume signed integer overflow behavior

2017-01-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dd2c7d497878 by Martin Panter in branch '3.5':
Issues #1621, #29145: Test for str.join() overflow
https://hg.python.org/cpython/rev/dd2c7d497878

New changeset eb6eafafdb44 by Martin Panter in branch 'default':
Issue #1621: Overflow should not be possible in listextend()
https://hg.python.org/cpython/rev/eb6eafafdb44

--

___
Python tracker 

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



[issue29145] failing overflow checks in replace_*

2017-01-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dd2c7d497878 by Martin Panter in branch '3.5':
Issues #1621, #29145: Test for str.join() overflow
https://hg.python.org/cpython/rev/dd2c7d497878

New changeset 0c6ea411af17 by Martin Panter in branch 'default':
Issue #29145: Merge test from 3.6
https://hg.python.org/cpython/rev/0c6ea411af17

--

___
Python tracker 

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



[issue22980] C extension naming doesn't take bitness into account

2017-01-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 80fc40a9ae47 by Martin Panter in branch '3.5':
Issue #22980: Skip a sysconfig test if _ctypes is not available.
https://hg.python.org/cpython/rev/80fc40a9ae47

--

___
Python tracker 

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



[issue29273] test___all__ alters utf8 locale setting

2017-01-13 Thread Martin Panter

New submission from Martin Panter:

On a Linux computer I have LANG=en_US.utf8 set. Python 3 initializes the locale 
with this setting (see revision 43e32b2b4004):

>>> locale.setlocale(locale.LC_CTYPE)  # Get setting initialized by Python
'en_US.utf8'

In Lib/test/test___all__.py, there is a special case to restore the locale 
after loading the “readline” module (last changed in revision 37ed6eed0595). It 
does this by calling getlocale() and later setlocale(). However the getlocale() 
call translates the setting to UTF-8 in uppercase with a dash, and setlocale() 
keeps it that way:

>>> locale.getlocale(locale.LC_CTYPE)
('en_US', 'UTF-8')
>>> locale.setlocale(locale.LC_CTYPE, _)
'en_US.UTF-8'

This means that the test framework may complain:

Warning -- locale was modified by test___all__

One subtlety is that I only see the warning when the “tkinter” module is 
unavailable. Otherwise, the test imports Lib/idlelib/iomenu.py, which calls 
setlocale(locale.LC_CTYPE, "") and restores the original “utf8” spelling.

The easiest fix would be to use setlocale(locale.LC_CTYPE) instead of 
getlocale() in test___all__. However I think it may be safe to remove this code 
entirely. The original version of the it was added by Guido in revision 
ba522c74a931 (year 2002). Three hours later is revision c7d5801bbae8, where 
Guido changed the “readline” module to restore the locale after Readline 
library initialization. Since the module is fixed, I don’t think we need the 
test workaround, and I propose to remove it in Python 3, where it causes the 
above conflict.

--
components: Tests
files: readline-getlocale.patch
keywords: patch
messages: 285467
nosy: martin.panter
priority: normal
severity: normal
stage: patch review
status: open
title: test___all__ alters utf8 locale setting
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46287/readline-getlocale.patch

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-13 Thread INADA Naoki

INADA Naoki added the comment:

1. _PyCFunction_FastCallKeywords() calls _PyStack_AsDict(), then calls 
_PyCFunction_FastCallDict().
2. _PyCFunction_FastCallDict() calls _Py_FastCall_FromArgs() when METH_FASTCALL.
3. _Py_FastCall_FromArgs() calls _PyStack_UnpackDict(), then calls fastcall().

Can you remove this _PyStack_AsDict() & _PyStack_UnpackDict() by creating 
shortcut in _PyCFunction_FastCallKeywords()?

--

___
Python tracker 

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



[issue29125] Shell injection via TIX_LIBRARY when using tkinter.tix

2017-01-13 Thread Larry Hastings

Larry Hastings added the comment:

Could one of you recent tagees (Terry, Zach) review the patch?  Hoping to tag 
3.5.3 final in less than 48 hours, and I want to cherry-pick the fix for 
this...!

--

___
Python tracker 

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



[issue29006] 2.7.13 _sqlite more prone to "database table is locked"

2017-01-13 Thread Larry Hastings

Larry Hastings added the comment:

Hoping to tag in less than 48 hours...!

--

___
Python tracker 

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



[issue29062] hashlib documentation link error

2017-01-13 Thread Martin Panter

Martin Panter added the comment:

Looks like Doc/tools/susp-ignored.csv needs updating:

$ make -C Doc/ suspicious
[. . .]
writing output... [ 49%] library/hashlib
WARNING: [library/hashlib:502] ":vatrogasac" found in ">>> cookie = 
b'user:vatrogasac'"
WARNING: [library/hashlib:502] ":vatrogasac" found in 
"user:vatrogasac,349cf904533767ed2d755279a8df84d0"
WARNING: [library/hashlib:502] ":policajac" found in ">>> 
compare_digest(b'user:policajac', sig)"
WARNING: [library/hashlib:646] ":LEAF" found in "... h00 = 
blake2b(buf[0:LEAF_SIZE], fanout=FANOUT, depth=DEPTH,"
[. . .]
WARNING: Found 4/327 unused rules:
library/hashlib-blake2,,:vatrogasac,>>> cookie = b'user:vatrogasac'
library/hashlib-blake2,,:vatrogasac,user:vatrogasac,349cf904533767ed2d755279a8df84d0
library/hashlib-blake2,,:policajac,>>> compare_digest(b'user:policajac', sig)
library/hashlib-blake2,,:LEAF,h00 = blake2b(buf[0:LEAF_SIZE], fanout=FANOUT, 
depth=DEPTH,
build finished with problems, 7 warnings.
make[1]: *** [build] Error 1
make[1]: Leaving directory `/media/disk/home/proj/python/cpython/Doc'
Suspicious check complete; look for any errors in the above output or in 
build/suspicious/suspicious.csv.  If all issues are false positives, append 
that file to tools/susp-ignored.csv.
make: *** [suspicious] Error 1

--
status: closed -> open

___
Python tracker 

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



[issue29263] Implement LOAD_METHOD/CALL_METHOD for C functions

2017-01-13 Thread INADA Naoki

INADA Naoki added the comment:

Maybe, we should do

* Make clinic use more METH_FASTCALL
* Use clinic more in builtin methods

before trying this optimization.

--

___
Python tracker 

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



[issue23407] os.walk always follows Windows junctions

2017-01-13 Thread Craig Holmquist

Craig Holmquist added the comment:

FWIW, the only name-surrogate tags in the user-mode SDK headers (specifically 
winnt.h) are IO_REPARSE_TAG_MOUNT_POINT and IO_REPARSE_TAG_SYMLINK, as of at 
least the Windows 8.1 SDK.

--

___
Python tracker 

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



[issue29263] Implement LOAD_METHOD/CALL_METHOD for C functions

2017-01-13 Thread INADA Naoki

INADA Naoki added the comment:

This is proof of concept patch to support LOAD_METHOD & CALL_METHOD for 
METH_FASTCALL methods.
(This patch should be applied after fastcall.patch)

$ ./python -m perf timeit --compare-to `pwd`/python-fastcall -s "d = b''" -- 
"d.decode()"
python-fastcall: . 91.0 ns +- 1.0 ns
python: . 80.3 ns +- 0.3 ns

Median +- std dev: [python-fastcall] 91.0 ns +- 1.0 ns -> [python] 80.3 ns +- 
0.3 ns: 1.13x faster

$ ./python -m perf timeit --compare-to `pwd`/python-fastcall -s "d = b''" -- 
"d.decode('ascii')"
python-fastcall: . 116 ns +- 1 ns
python: . 106 ns +- 1 ns

Median +- std dev: [python-fastcall] 116 ns +- 1 ns -> [python] 106 ns +- 1 ns: 
1.10x faster


Since PyCFunction is lighter than PyMethodObject, performance benefit seems 
smaller than
Python method (up to 20%).

Sadly speaking, there are only few METH_FASTCALL in builtin type.

--
keywords: +patch
Added file: http://bugs.python.org/file46286/loadmethod-fastcall.patch

___
Python tracker 

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



Python Web Scrapping : Within href readonly those value that have href in it

2017-01-13 Thread shahsn11
I am trying to scrape a webpage just for learning. In that webpage there are 
multiple "a" tags. consider the below code

 Something 

 Something


Now i want to read only those href in which there is http. My Current code is

for link in soup.find_all("a"):
print link.get("href")

i would like to change it to read only http links.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can not run the Python software

2017-01-13 Thread Bernard via Python-list

Thanks for the info..
 
 
 
-Original Message-
From: Michael Torrie 
To: python-list 
Sent: Fri, Jan 13, 2017 11:08 pm
Subject: Re: Can not run the Python software

On 01/13/2017 08:32 PM, Joseph L. Casale wrote:
>> Just downloaded Python 3.6.0 2016-12-23 and PyCharm. Tried to run the "Hello 
>> World" program and got the following message:
>> "Process finished with exit code 1073741515 (0xC135)" 
>> I am using Windows 8.1 on an HP ENVY Touchsmart Notebook (64-bit OS, 
>> x64-based processor).
> 
> If you track the error, it indicates a file was not found, bets are
> you don't have the needed runtime installed for Python to run.
> 
> Nothing else PyCharm can do here, it tries to start Python and
> fails.
> 
> If memory serves me, you need the Visual C++ Redistributable
> for Visual Studio 2015...

And this is coming up a lot.  This is something that should already be
on all supported versions of Windows if Windows updates are done, right?
 It's probably in the FAQ on python.org, and I know this is really a
user problem (not installing updates), but maybe it's time that the
Python installer bundles the redistributable installer and installs it
if necessary during Python's install.  We get queries on the list almost
weekly from Windows users.
-- 
https://mail.python.org/mailman/listinfo/python-list

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


RE: Can not run the Python software

2017-01-13 Thread Joseph L. Casale
> And this is coming up a lot.  This is something that should already be
> on all supported versions of Windows if Windows updates are done, right?

No, it's not an update. You install the runtime *if* you need it.

 > but maybe it's time that the
> Python installer bundles the redistributable installer and installs it
> if necessary during Python's install.

That's exactly how most other software does work and wix for example
even has support for it...

http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/


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


Re: Can not run the Python software

2017-01-13 Thread Michael Torrie
On 01/13/2017 08:32 PM, Joseph L. Casale wrote:
>> Just downloaded Python 3.6.0 2016-12-23 and PyCharm. Tried to run the "Hello 
>> World" program and got the following message:
>> "Process finished with exit code 1073741515 (0xC135)" 
>> I am using Windows 8.1 on an HP ENVY Touchsmart Notebook (64-bit OS, 
>> x64-based processor).
> 
> If you track the error, it indicates a file was not found, bets are
> you don't have the needed runtime installed for Python to run.
> 
> Nothing else PyCharm can do here, it tries to start Python and
> fails.
> 
> If memory serves me, you need the Visual C++ Redistributable
> for Visual Studio 2015...

And this is coming up a lot.  This is something that should already be
on all supported versions of Windows if Windows updates are done, right?
 It's probably in the FAQ on python.org, and I know this is really a
user problem (not installing updates), but maybe it's time that the
Python installer bundles the redistributable installer and installs it
if necessary during Python's install.  We get queries on the list almost
weekly from Windows users.
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Can not run the Python software

2017-01-13 Thread Joseph L. Casale
> Just downloaded Python 3.6.0 2016-12-23 and PyCharm. Tried to run the "Hello 
> World" program and got the following message:
> "Process finished with exit code 1073741515 (0xC135)" 
> I am using Windows 8.1 on an HP ENVY Touchsmart Notebook (64-bit OS, 
> x64-based processor).

If you track the error, it indicates a file was not found, bets are
you don't have the needed runtime installed for Python to run.

Nothing else PyCharm can do here, it tries to start Python and
fails.

If memory serves me, you need the Visual C++ Redistributable
for Visual Studio 2015...

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


Re: Software to Control RGB Strips

2017-01-13 Thread Brett Salyer
On Friday, January 13, 2017 at 1:07:40 PM UTC-5, Brett Salyer wrote:
> Hey all,
> 
> I was debating on getting some RGB light strips for my room. I noticed, from 
> this tutorial:
> 
> http://popoklopsi.github.io/RaspberryPi-LedStrip/#!/ws2812
> 
> 
> there is a  WS2812x library to run commands that control the RGB strip. Well, 
> I wanted to, instead of running commands through a terminal, create a GUI 
> using python, then exploit the library I mentioned above to create a piece of 
> software that controls my lighting from my Raspberry Pi.
> 
> I was going to use Tkinter to create the GUI. 
> 
> Now, I'm a pretty beginner programmer, having only taken a C++ course and the 
> Java course I'm in now.
> 
> Do I just need to download the WS2812x library, and, then, access that 
> library as I would, say, a header file in C++? In Pythons syntax, of course.
> 
> Anything to get me pointed in the right direction would be greatly 
> appreciated! Thanks!

Thanks a lot, man!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Can not run the Python software

2017-01-13 Thread Michael Torrie
On 01/13/2017 06:34 PM, Bernard via Python-list wrote:
> Hi,
>  
> Just downloaded Python 3.6.0 2016-12-23 and PyCharm. Tried to run the "Hello 
> World" program and got the following message:
> "Process finished with exit code 1073741515 (0xC135)" 
> I am using Windows 8.1 on an HP ENVY Touchsmart Notebook (64-bit OS, 
> x64-based processor).
> Help Needed

Unfortunately there's not a lot of information there to go on, which is
why you haven't got any replies yet.  What was the python program you
tried to run? How did you run it?  The error message you quote does not
appear to be a Python error message, so I'm not sure where it is coming
from.  It's possible the python interpreter itself crashed, which is
unusual, especially for a simple program.  Can you post the entire
python program you were trying to run?

Also can you try a simple program of your own such as this as a sanity
check?

print ("Hello, World.")


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


[issue29271] Task.current_task(None) returns unexpected result

2017-01-13 Thread INADA Naoki

INADA Naoki added the comment:

LGTM

--

___
Python tracker 

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



[issue26296] colorsys rgb_to_hls algorithm error

2017-01-13 Thread Bryan B

Bryan B added the comment:

Well, the other issue was resolved by updating Python on my computer to 3.6 ;)

Setting up the entire Python build and test environment for an issue this small 
seems a little excessive, especially for a module that seems seldomly used. I'm 
gonna have to be that guy and let this one sit as well.

Sorry :(

--
title: colorys rgb_to_hls algorithm error -> colorsys rgb_to_hls algorithm error

___
Python tracker 

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



[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-13 Thread Eryk Sun

Changes by Eryk Sun :


--
stage:  -> patch review

___
Python tracker 

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



[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-13 Thread Eryk Sun

Eryk Sun added the comment:

Here's a patch that deletes __classcell__ from the dict before calling type_new.

--
keywords: +patch
Added file: http://bugs.python.org/file46285/issue_29270_01.patch

___
Python tracker 

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



[issue26296] colorys rgb_to_hls algorithm error

2017-01-13 Thread Bryan B

Bryan B added the comment:

Adding myself to this since I'm going to fix another hiccup in this file and I 
might as well clean this up too.

--
nosy: +aarqon

___
Python tracker 

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



Re: Can not run the Python software

2017-01-13 Thread Bernard via Python-list

 
 
 
-Original Message-
From: hba008 
To: hba008 ; python-list 
Sent: Fri, Jan 13, 2017 7:02 pm
Subject: Re: Can not run the  Python software



I have been added to the mailing list per your instructions. Please, have 
someone address the problem belowThanks


Sent from my Sprint Phone.




-- Original message--
From: 
Date: Thu, Jan 5, 2017 10:13 PM
To: python-list@python.org;
Subject:Can not run the  Python software



Hi,
 
Just downloaded Python 3.6.0 2016-12-23 and PyCharm. Tried to run the "Hello 
World" program and got the following message:
"Process finished with exit code 1073741515 (0xC135)" 
I am using Windows 8.1 on an HP ENVY Touchsmart Notebook (64-bit OS, x64-based 
processor).
Help Needed
Thanks,
Bernard


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


[issue29272] test_logging hangs if /etc/hosts only aliases "localhost" to ::1

2017-01-13 Thread Brian Vandenberg

New submission from Brian Vandenberg:

On some of the linux boxes on our (air-gapped, if that matters) network it 
looks like some of them were mis-configured and their /etc/hosts file looks 
something like this:

$ cat /etc/hosts
127.0.0.1 snoopy.the.internal.domain snoopy localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

... whereas for other linux machines not exhibiting this problem:

$ cat /etc/hosts
127.0.0.1 woodstock.the.internal.domain woodstock localhost 
localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

It appears this is causing test_logging to hang while running SocketHandlerTest.

Unfortunately I don't have administrative privileges so I'm not able to prove 
I'm right.  I only have circumstantial evidence, but no machine I tested (about 
20 machines) contradicts what I stated above.

--
components: Tests
messages: 285452
nosy: phantal
priority: normal
severity: normal
status: open
title: test_logging hangs if /etc/hosts only aliases "localhost" to ::1
type: behavior
versions: Python 3.6

___
Python tracker 

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



Re: How can I make a sentinel value NOT be initialized in a class/method - OOP?

2017-01-13 Thread sohcahtoa82
On Friday, January 13, 2017 at 2:27:04 PM UTC-8, David D wrote:
> I am testing out some basic Object Oriented Programming in Python.  The 
> basics: 
> 
> -User enters a name 
> -While loop with a sentinel value of "quit" will continue entering names 
> until the sentinel value is reached 
> -The object is created with the inputted value (NAME and until a sentinel 
> value is entered) 
> -the object is then printed out using the constructor __str__ 
> 
> In my solution ( I am saying this because someone might have a work around 
> that doesn't include the following below) 
> -I want to use __init__ 
> -I want to use __str__ 
> -I want to use a while loop with a sentinel value 
> 
> EXPLANATION: 
> I want to have the user enter in their NAME using a while loop, with "quit" 
> being the sentinel value that breaks the loop.  Once the name is entered, an 
> object is created and it is passed into a constructor def __ini__ (self, 
> name) and then I have them return a string value using __str__ for the name 
> entered. 
> The issue I am having is that when i enter the sentinel value of QUIT, it 
> gets initialized as the name and printed out.  How can I get around this?  I 
> hope this makes sense.

It would help if you posted your code to see what you're doing.

Also, is the sentinel value supposed to be "quit" or "QUIT"?  If you're only 
checking for "quit", but you type "QUIT", it isn't going to work.  Programs 
execute exactly as you write them, and "quit" is not the same as "QUIT".
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-13 Thread STINNER Victor

STINNER Victor added the comment:

> Slower (63):
> - unpickle_pure_python: 671 us +- 16 us -> 952 us +- 9 us: 1.42x slower (+42%)
> ...

This benchmark was run with LTO+PGO. It seems like PGO produced less efficient 
machine code with the patch. Maybe a missed optimization.

Oh, I just realized that I announced that objects with a __call__() are faster, 
but it's not the case yet! Such object still gets slot_tp_call() as tp_call 
which isn't a fastcall!

--

___
Python tracker 

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



Re: Extended ASCII [solved]

2017-01-13 Thread D'Arcy Cain

On 2017-01-13 05:44 PM, Grant Edwards wrote:

On 2017-01-13, D'Arcy Cain  wrote:


Here is the failing code:

with open(sys.argv[1], encoding="latin-1") as fp:
   for ln in fp:
 print(ln)

Traceback (most recent call last):
   File "./load_iff", line 11, in 
 print(ln)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in
position 132: ordinal not in range(128)

I don't understand why the error says "ascii" when I told it to use
"latin-1".


That can't be the failing code, since it's failing at line 11, and
that's only 5 lines. It helps if we can tell which line generated the
error.  ;)


I didn't think that the part leading up to it was relevant.  Here it is.

#! /usr/bin/python

import sys, os

if len(sys.argv) < 2:
print("No file named", file=sys.stderr)
sys.exit(1)


I'm _guessing_ that line 11 is the print(), and it's barfing because


Of course.  That's why the error is listed right below it.


stdout is using ascii encoding, and there's no way to encode that
character in ascii so that it can be printed to an ascii output
stream.


Thank you!  I know all about that but for some reason I did not have 
PYTHONIOENCODING=utf8 set on that particular machine.  I have it set on 
every other machine I work on an never thought to check.  My Unicode 
universe is all right again.


Cheers.

--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@vex.net
VoIP: sip:da...@vex.net
--
https://mail.python.org/mailman/listinfo/python-list


Re: Can not run the Python software

2017-01-13 Thread hba...@aol.com via Python-list






I have been added to the mailing list per your instructions. Please, have 
someone address the problem belowThanks
Sent from my Sprint Phone.



-- Original message--From: Date: Thu, Jan 5, 2017 10:13 PMTo: 
python-list@python.org;Subject:Can not run the  Python software
Hi, Just downloaded Python 3.6.0 2016-12-23 and PyCharm. Tried to run the 
"Hello World" program and got the following message:"Process finished with exit 
code 1073741515 (0xC135)" I am using Windows 8.1 on an HP ENVY Touchsmart 
Notebook (64-bit OS, x64-based processor).Help NeededThanks,Bernard
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Announcement: TLSv1.2 will become mandatory in the future for Python.org Sites

2017-01-13 Thread oliver
When I run this per email from my work laptop,

python3 -c "import urllib.request,json;
print(json.loads(urllib.request.urlopen('
https://www.howsmyssl.com/a/check').read())['tls_version'])"

I get the following traceback:

C:\...>python -c "import urllib.request,json;
print(json.loads(urllib.request.url
w.howsmyssl.com/a/check').read())['tls_version'])"
Traceback (most recent call last):
File "c:\Python35\lib\urllib\request.py", line 1254, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
File "c:\Python35\lib\http\client.py", line 1106, in request
self._send_request(method, url, body, headers)
File "c:\Python35\lib\http\client.py", line 1151, in _send_request
self.endheaders(body)
File "c:\Python35\lib\http\client.py", line 1102, in endheaders
self._send_output(message_body)
File "c:\Python35\lib\http\client.py", line 934, in _send_output
self.send(msg)
File "c:\Python35\lib\http\client.py", line 877, in send
self.connect()
File "c:\Python35\lib\http\client.py", line 1260, in connect
server_hostname=server_hostname)
File "c:\Python35\lib\ssl.py", line 377, in wrap_socket
_context=self)
File "c:\Python35\lib\ssl.py", line 752, in __init__
self.do_handshake()
File "c:\Python35\lib\ssl.py", line 988, in do_handshake
self._sslobj.do_handshake()
File "c:\Python35\lib\ssl.py", line 633, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
(_ssl.c:645)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in 
File "c:\Python35\lib\urllib\request.py", line 163, in urlopen
return opener.open(url, data, timeout)
File "c:\Python35\lib\urllib\request.py", line 466, in open
response = self._open(req, data)
File "c:\Python35\lib\urllib\request.py", line 484, in _open
'_open', req)
File "c:\Python35\lib\urllib\request.py", line 444, in _call_chain
result = func(*args)
File "c:\Python35\lib\urllib\request.py", line 1297, in https_open
context=self._context, check_hostname=self._check_hostname)
File "c:\Python35\lib\urllib\request.py", line 1256, in do_open
raise URLError(err)
urllib.error.URLError: 

Anyone know how to deal with that? When using pip, I get same error, unless
I add "--trusted-host pypi.python.org":

C:\...>pip install nose
Collecting nose
Could not fetch URL https://pypi.python.org/simple/nose/: There was a
problem confirming the ssl certificate: [SSL: CERTIF
LED] certificate verify failed (_ssl.c:645) - skipping
Could not find a version that satisfies the requirement nose (from
versions: )
No matching distribution found for nose

C:\...>pip install nose --trusted-host pypi.python.org
Collecting nose
Downloading nose-1.3.7-py3-none-any.whl (154kB)
100% || 163kB 386kB/s
Installing collected packages: nose
Successfully installed nose-1.3.7


-- 
Oliver
-- 
Oliver
My StackOverflow contributions
My CodeProject articles
My Github projects
My SourceForget.net projects
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-13 Thread Eryk Sun

Eryk Sun added the comment:

In 3.6, type_new in Objects/typeobject.c sets the __classcell__ in the dict if 
it's a cell object. It happens that CreateSwappedType in 
Modules/_ctypes/_ctypes.c re-uses the dict to create the swapped type (e.g. big 
endian), which in turn updates the __classcell__. Thus in 
builtin___build_class__ in Python/bltinmodule.c, the check `cell_cls != cls` 
ends up being true, which leads to the observed TypeError. CreateSwappedType 
should be able to avoid this by either deleting "__classcell__" from the dict 
or creating a copy without it before passing it to type_new.

--
nosy: +eryksun

___
Python tracker 

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



Re: How can I make a sentinel value NOT be initialized in a class/method - OOP?

2017-01-13 Thread Ian Kelly
On Jan 13, 2017 3:33 PM,  wrote:


The issue I am having is that when i enter the sentinel value of QUIT, it
gets initialized as the name and printed out.  How can I get around this?
I hope this makes sense.


Hard to say for certain without seeing your code, but the most likely cause
of this is that the input string contains a trailing newline that causes it
to differ from the sentinel value you're comparing it to. Consider using
the rstrip string method to remove any trailing whitespace.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue18235] _sysconfigdata.py wrong on AIX installations

2017-01-13 Thread Michael Felt

Michael Felt added the comment:

I did not go through a whole build process.

Changing:


if _PYTHON_BUILD:
vars['BLDSHARED'] = vars['LDSHARED']
to

if _PYTHON_BUILD:
vars['LDSHARED'] = vars['BLDSHARED']

is not going to help if both variables are wrong in _sysconfigdata*.py

Also,

The patch is not applied in any version - yet the values in _sysconfigdata*.py 
are different, i.e., version dependent (without the patch).

If I errored in my assumption that the file being patched is reading 
_sysconfigdata*.py then I will need to patch and build from scratch to see the 
effect on _sysconfigdata.py

--

___
Python tracker 

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



Re: How can I make a sentinel value NOT be initialized in a class/method - OOP?

2017-01-13 Thread Erik

Hi,

On 13/01/17 22:26, daviddsch...@gmail.com wrote:

The issue I am having is that when i enter the sentinel value of QUIT, it gets 
initialized as the name and printed out.  How can I get around this?


If I understand the question correctly (which looks like it's just a 
re-worded homework question (*)), you need to look at the 'if' statement:


https://docs.python.org/3/tutorial/controlflow.html#if-statements

E.

(*) If it is a homework question, you'd look better on the list to state 
it as such, and post some code that at least tries to answer the 
question before you're likely to get a useful response. However, as you 
have indicated a specific problem, I'll assume you have actually written 
some code.

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


[issue29271] Task.current_task(None) returns unexpected result

2017-01-13 Thread Lele Gaifax

Lele Gaifax added the comment:

Yay, Yury is too fast!! :-)

--

___
Python tracker 

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



[issue29271] Task.current_task(None) returns unexpected result

2017-01-13 Thread Lele Gaifax

Lele Gaifax added the comment:

FWIW, the problem afflicts other functions, for example the following script 
exhibits a similar difference:

import asyncio

async def coro():
print(asyncio.Task.all_tasks())
print(asyncio.Task.all_tasks(None))

loop = asyncio.get_event_loop()
loop.run_until_complete(coro())

--

___
Python tracker 

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



Re: Extended ASCII

2017-01-13 Thread Jon Ribbens
On 2017-01-13, D'Arcy Cain  wrote:
> I thought I was done with this crap once I moved to 3.x but some 
> Winblows machines are still sending what some circles call "Extended 
> ASCII".  I have a file that I am trying to read and it is barfing on 
> some characters.  For example:
>
>due to the Qu\xe9bec government
>
> Obviously should be "due to the Québec government".  I can't figure out 
> what that encoding is or if it is anything that can even be understood 
> outside of M$.

$ cat decode.py
#!/usr/bin/env python3

CODECS = (
"ascii", "big5", "big5hkscs", "cp037", "cp273", "cp424", "cp437", "cp500",
"cp720", "cp737", "cp775", "cp850", "cp852", "cp855", "cp856", "cp857",
"cp858", "cp860", "cp861", "cp862", "cp863", "cp864", "cp865", "cp866",
"cp869", "cp874", "cp875", "cp932", "cp949", "cp950", "cp1006", "cp1026",
"cp1125", "cp1140", "cp1250", "cp1251", "cp1252", "cp1253", "cp1254",
"cp1255", "cp1256", "cp1257", "cp1258", "cp65001", "euc_jp",
"euc_jis_2004", "euc_jisx0213", "euc_kr", "gb2312", "gbk", "gb18030", "hz",
"iso2022_jp", "iso2022_jp_1", "iso2022_jp_2", "iso2022_jp_2004",
"iso2022_jp_3", "iso2022_jp_ext", "iso2022_kr", "latin_1", "iso8859_2",
"iso8859_3", "iso8859_4", "iso8859_5", "iso8859_6", "iso8859_7",
"iso8859_8", "iso8859_9", "iso8859_10", "iso8859_11", "iso8859_13",
"iso8859_14", "iso8859_15", "iso8859_16", "johab", "koi8_r", "koi8_t",
"koi8_u", "kz1048", "mac_cyrillic", "mac_greek", "mac_iceland",
"mac_latin2", "mac_roman", "mac_turkish", "ptcp154", "shift_jis",
"shift_jis_2004", "shift_jisx0213", "utf_32", "utf_32_be", "utf_32_le",
"utf_16", "utf_16_be", "utf_16_le", "utf_7", "utf_8", "utf_8_sig",
)

for encoding in CODECS:
try:
if b"Qu\xe9bec".decode(encoding) == "Québec":
print(encoding)
except (UnicodeError, LookupError):
pass

$ ./decode.py 
cp1250
cp1252
cp1254
cp1256
cp1257
cp1258
latin_1
iso8859_2
iso8859_3
iso8859_4
iso8859_9
iso8859_10
iso8859_13
iso8859_14
iso8859_15
iso8859_16
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Extended ASCII

2017-01-13 Thread Grant Edwards
On 2017-01-13, D'Arcy Cain  wrote:

> Here is the failing code:
>
> with open(sys.argv[1], encoding="latin-1") as fp:
>for ln in fp:
>  print(ln)
>
> Traceback (most recent call last):
>File "./load_iff", line 11, in 
>  print(ln)
> UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in 
> position 132: ordinal not in range(128)
>
> I don't understand why the error says "ascii" when I told it to use 
> "latin-1".

That can't be the failing code, since it's failing at line 11, and
that's only 5 lines. It helps if we can tell which line generated the
error.  ;)

I'm _guessing_ that line 11 is the print(), and it's barfing because
stdout is using ascii encoding, and there's no way to encode that
character in ascii so that it can be printed to an ascii output
stream.

-- 
Grant Edwards   grant.b.edwardsYow! Everybody gets free
  at   BORSCHT!
  gmail.com

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


[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +ncoghlan, serhiy.storchaka
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



Re: Extended ASCII

2017-01-13 Thread Random832
On Fri, Jan 13, 2017, at 17:24, D'Arcy Cain wrote:
> I thought I was done with this crap once I moved to 3.x but some 
> Winblows machines are still sending what some circles call "Extended 
> ASCII".  I have a file that I am trying to read and it is barfing on 
> some characters.  For example:
> 
>due to the Qu\xe9bec government
> 
> Obviously should be "due to the Québec government".  I can't figure out 
> what that encoding is or if it is anything that can even be understood 
> outside of M$.  I have tried ascii, cp437, cp858, cp1140, cp1250, 
> latin-1, utf8 and others.  None of them recognize that character.  Can 
> someone tell me what encoding includes that character please.

It's latin-1 (or possibly cp1252 or something else depending on other
characters), your problem is elsewhere.

> Here is the failing code:
> 
> with open(sys.argv[1], encoding="latin-1") as fp:
>for ln in fp:
>  print(ln)
> 
> Traceback (most recent call last):
>File "./load_iff", line 11, in 
>  print(ln)
> UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in 
> position 132: ordinal not in range(128)

Note that this is an encode error - it's converting *from* unicode *to*
bytes, for the print statement.
 
> I don't understand why the error says "ascii" when I told it to use 
> "latin-1".

You set the encoding for the file, not the output. The problem is in
your print statement, and the fact that you probably have your locale
set to "C" or not set up at all instead of e.g. "en_CA.UTF-8".
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29271] Task.current_task(None) returns unexpected result

2017-01-13 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



Extended ASCII

2017-01-13 Thread D'Arcy Cain
I thought I was done with this crap once I moved to 3.x but some 
Winblows machines are still sending what some circles call "Extended 
ASCII".  I have a file that I am trying to read and it is barfing on 
some characters.  For example:


  due to the Qu\xe9bec government

Obviously should be "due to the Québec government".  I can't figure out 
what that encoding is or if it is anything that can even be understood 
outside of M$.  I have tried ascii, cp437, cp858, cp1140, cp1250, 
latin-1, utf8 and others.  None of them recognize that character.  Can 
someone tell me what encoding includes that character please.


Here is the failing code:

with open(sys.argv[1], encoding="latin-1") as fp:
  for ln in fp:
print(ln)

Traceback (most recent call last):
  File "./load_iff", line 11, in 
print(ln)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in 
position 132: ordinal not in range(128)


I don't understand why the error says "ascii" when I told it to use 
"latin-1".


--
D'Arcy J.M. Cain
Vybe Networks Inc.
http://www.VybeNetworks.com/
IM:da...@vex.net VoIP: sip:da...@vybenetworks.com
--
https://mail.python.org/mailman/listinfo/python-list


How can I make a sentinel value NOT be initialized in a class/method - OOP?

2017-01-13 Thread daviddschool
I am testing out some basic Object Oriented Programming in Python.  The basics: 

-User enters a name 
-While loop with a sentinel value of "quit" will continue entering names until 
the sentinel value is reached 
-The object is created with the inputted value (NAME and until a sentinel value 
is entered) 
-the object is then printed out using the constructor __str__ 

In my solution ( I am saying this because someone might have a work around that 
doesn't include the following below) 
-I want to use __init__ 
-I want to use __str__ 
-I want to use a while loop with a sentinel value 

EXPLANATION: 
I want to have the user enter in their NAME using a while loop, with "quit" 
being the sentinel value that breaks the loop.  Once the name is entered, an 
object is created and it is passed into a constructor def __ini__ (self, name) 
and then I have them return a string value using __str__ for the name entered. 
The issue I am having is that when i enter the sentinel value of QUIT, it gets 
initialized as the name and printed out.  How can I get around this?  I hope 
this makes sense.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29265] os.cpu_count is problematic on sparc/solaris

2017-01-13 Thread Brian Vandenberg

Brian Vandenberg added the comment:

> It doesn't cause any real problem with the tests, though.  I routinely run 
> with -j40 on my 2 cpu test box because the test run completes faster that way 
> due to the way many tests spend time waiting for various things.

In my case it did because it caused enough file descriptors to be allocated 
that it hit the cap for max open file handles.

--

___
Python tracker 

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



[issue29271] Task.current_task(None) returns unexpected result

2017-01-13 Thread Lele Gaifax

Changes by Lele Gaifax :


--
nosy: +lelit

___
Python tracker 

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



[issue29271] Task.current_task(None) returns unexpected result

2017-01-13 Thread Alberto Berti

Changes by Alberto Berti :


--
nosy: +azazel

___
Python tracker 

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



[issue29271] Task.current_task(None) returns unexpected result

2017-01-13 Thread Yury Selivanov

Changes by Yury Selivanov :


--
keywords: +patch
nosy: +inada.naoki
Added file: http://bugs.python.org/file46284/task.patch

___
Python tracker 

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



[issue29271] Task.current_task(None) returns unexpected result

2017-01-13 Thread Yury Selivanov

New submission from Yury Selivanov:

Quoting Alberto Berdi from python-tulip mailing list:

working with the Python 3.6 asyncio implemented in C, i've got what is
for me a strange behavior of the asyncio.Task.current task
function. Executing the following test:

 import asyncio

 async def coro():
 print(asyncio.Task.current_task())
 print(asyncio.Task.current_task(None))
 print(asyncio.Task.current_task(loop=asyncio.get_event_loop()))

 loop = asyncio.get_event_loop()
 loop.run_until_complete(coro())

in Py3.5, I obtain the result:

 
cb=[_run_until_complete_cb() at /usr/lib/python3.5/asyncio/base_events.py:176]>
 
cb=[_run_until_complete_cb() at /usr/lib/python3.5/asyncio/base_events.py:176]>
 
cb=[_run_until_complete_cb() at /usr/lib/python3.5/asyncio/base_events.py:176]>

In Py3.6, i get:

 
cb=[_run_until_complete_cb() at /usr/lib/python3.6/asyncio/base_events.py:176]>
None
 
cb=[_run_until_complete_cb() at /usr/lib/python3.6/asyncio/base_events.py:176]>

What's going on here? It's still right to expect the same result from the three 
calls or something has changed?
The documentation for the Task.current_task() function seems unchanged between 
the two version.

My python3.6 has version:

$ python3.6 -VV
Python 3.6.0 (default, Dec 29 2016, 04:29:02) 
[GCC 6.2.1 20161215]

--
assignee: yselivanov
components: asyncio
messages: 285445
nosy: gvanrossum, yselivanov
priority: normal
severity: normal
stage: patch review
status: open
title: Task.current_task(None) returns unexpected result
type: behavior
versions: 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



[issue29270] super call in ctypes sub-class fails in 3.6

2017-01-13 Thread Dave Jones

New submission from Dave Jones:

While investigating a bug report in one of my libraries 
(https://github.com/waveform80/picamera/issues/355) I've come across a 
behaviour that appears in Python 3.6 but not prior versions. Specifically, 
calling super() in a sub-class of a ctypes scalar type appears to fail at the 
class definition stage. A minimal test case is as follows:

import ctypes as ct

class SuperTest(ct.c_uint32):
def __repr__(self):
return super().__repr__()

This works happily under python 3.2, 3.4, and 3.5 (that I've tested), and also 
under 2.7 (with the appropriate modification to super's arguments). However, 
under 3.6 it elicits the following exception:

Traceback (most recent call last):
  File "py36_ctypes.py", line 3, in 
class SuperTest(ct.c_uint32):
TypeError: __class__ set to  defining 
'SuperTest' as 

Reading through the "What's New" list in 3.6, I thought this might be something 
to do with the PEP-487 implementation (given it modified class construction), 
but having read through the PEP and associated patches I'm not so sure as I 
can't see anything that affects the setting of the "__class__" attribute (but 
don't rule it out on that basis; I'm no expert!).

I'll admit that sub-classing one of ctypes' scalar types is a little odd, but 
given this works in prior versions and there doesn't appear to be anything in 
the documentation banning the practice (that I've found?) this might constitute 
a bug?

--
components: ctypes
messages: 285444
nosy: Dave Jones
priority: normal
severity: normal
status: open
title: super call in ctypes sub-class fails in 3.6
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue16189] config/ld_so_aix not found: old dir name

2017-01-13 Thread Martin Panter

Changes by Martin Panter :


--
title: ld_so_aix not found -> config/ld_so_aix not found: old dir name

___
Python tracker 

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



[issue18235] _sysconfigdata.py wrong on AIX installations

2017-01-13 Thread Martin Panter

Martin Panter added the comment:

So are you saying you tried patching Python 2 and/or 3, but did not see any 
relevant change at all?

--

___
Python tracker 

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



[issue25825] AIX shared library extension modules installation broken: wrong dir names

2017-01-13 Thread Martin Panter

Changes by Martin Panter :


--
title: AIX shared library extension modules installation broken -> AIX shared 
library extension modules installation broken: wrong dir names

___
Python tracker 

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



[issue29266] test_create_connection_service_name fails if "http" isn't listed in /etc/services

2017-01-13 Thread R. David Murray

Changes by R. David Murray :


--
components: +asyncio
nosy: +gvanrossum, yselivanov

___
Python tracker 

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



[issue29266] test_create_connection_service_name fails if "http" isn't listed in /etc/services

2017-01-13 Thread R. David Murray

R. David Murray added the comment:

It looks like that test already does so (it expects an OSError when passed the 
service name 'nonsense').

--
nosy: +r.david.murray

___
Python tracker 

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



[issue29265] os.cpu_count is problematic on sparc/solaris

2017-01-13 Thread R. David Murray

R. David Murray added the comment:

You don't know it, but you are actually reporting a possible sparc/Solaris 
specific (I think) bug against os.cpu_count.  There was some discussion about 
how cpu_count might be problematic in this regard.

It doesn't cause any real problem with the tests, though.  I routinely run with 
-j40 on my 2 cpu test box because the test run completes faster that way due to 
the way many tests spend time waiting for various things.

--
components: +Library (Lib) -Tests
nosy: +r.david.murray

___
Python tracker 

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



[issue29269] test_socket failing in solaris

2017-01-13 Thread Brian Vandenberg

New submission from Brian Vandenberg:

I started looking into this failure to see if I could figure out why but it 
looks like I'd have to spend more time than I have available to figure out the 
cause.

Environment/setup:
* air-gapped network (no internet access)
* sparc / Solaris 10
* Built with gcc 6.3.0
* Altered configure script to change -std=c99 to -std=gnu99 (see issue 29264)
* The only configure flags used were --prefix and --with-universal-archs=all


When I run test_socket I see the following 4 failures; please note, I'm hand 
typing the results so I may typo something:


ERROR: testCount (test.test_socket.SendfileUsingSendfileTest)
Traceback:
  File "(...)/test_socket.py", line 5248, in testCount
  File "(...)/test_socket.py", line 5151, in recv_data
MemoryError

Error: testCount (test.test_socket.SendfileUsingSendfileTest)
Traceback:
  File "(...)/test_socket.py", line 277, in _tearDown
  File "(...)/test_socket.py", line 289, in clientRun
  File "(...)/test_socket.py", line 5241, in _testCount
  File "(...)/Lib/socket.py", line 296, in _sendfile_use_sendfile
socket.timeout: timed out

Error: testWithTimeout (test.test_socket.SendfileUsingSendfileTest)
Traceback:
  File "(...)/test_socket.py", line 5318, in testWithTimeout
data = self.recv_data(conn)
  File "(...)/test_socket.py", line 5151, in recv_data
chunk = conn.recv(self.BUFSIZE)
MemoryError

Error: testWithTimeout (test.test_socket.SendfileUsingSendfileTest)
Traceback:
  File "(...)/test_socket.py", line 277, in _tearDown
raise exc
  File "(...)/test_socket.py", line 289, in clientRun
test_func()
  File "(...)/test_socket.py", line 5313, in _testWithTimeout
sent = meth(file)
  File "(...)/Lib/socket.py", line 296, in _sendfile_use_sendfile
socket.timeout: timed out

Error: testCountWithOffset (test.test_socket.SendfileUsingSendfileTest)
Traceback:
  File "(...)/test_socket.py", line 5287, in testCountWithOffset
self.assertEqual(len(data), count)
AssertionError: 4376231 != 17

Ran 539 tests in 69.166s

FAILED (failures=1, errors=4, skipped=324)
test test_socket failed

--
components: Tests
messages: 285440
nosy: phantal
priority: normal
severity: normal
status: open
title: test_socket failing in solaris
type: behavior
versions: Python 3.6

___
Python tracker 

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



Re: Byte-run: a Python interpreter written in Python

2017-01-13 Thread Ned Batchelder
On Friday, January 13, 2017 at 12:09:52 PM UTC-5, Ian wrote:
> On Fri, Jan 13, 2017 at 3:46 AM, Steve D'Aprano
>  wrote:
> >
> > http://aosabook.org/en/500L/a-python-interpreter-written-in-python.html
> 
> Neat. But not really surprising IMO that it can fit into 500 lines,
> since it doesn't handle compiling Python into bytecode (which is the
> hard part) and doesn't include libraries. There doesn't seem to be
> much purpose to this other than it being a toy project written for a
> book.

I can tell you what its purpose was: it was to verify my understanding
of the execution semantics of Python bytecode.  At the time, coverage.py
analyzed code for possible branches by reading the bytecode.  There are
some very tricky bytecodes, and I wasn't sure that I understood what they
did.

I figured that if I could implement a Python VM, then it would prove that
I understood it, or would shine a light on my misconceptions.

I thought perhaps someone had done it already.  I found Paul Swartz's vm2
code, which was a very similar idea. I refactored it, polished it up, and
extended it, and the result was byterun.

It served its purpose: although it didn't execute everything properly,
there were some twisty bits made clearer by the exercise.  Post-Script:
coverage.py no longer uses bytecode analysis, it uses AST analysis, which
works much better.

Since we're talking about possible purposes: Paul Swartz's original goal
was to sandbox Python execution. I'm not sure that was a realistic goal
for code like this, but that was his goal.

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


[issue29268] test_spwd fails on solaris using NIS users

2017-01-13 Thread Brian Vandenberg

New submission from Brian Vandenberg:

On all our solaris 10 machines when I run a simple test program it never 
reports a failure when calling getspnam:

   #include 
   #include 
   int main( int, char** ) {
 spwd *asdf = getspnam( "some_user" );
 if( NULL == sdf ) {
   perror( "getspnam" );
 }
 return 0;
   }

If I run the above program on our linux boxes it fails as expected, but on our 
solaris machines it produces the same information you'd see running "ypcat 
passwd | grep some_user".

I suspect either there's a bug in the solaris implementation of getpwnam() or 
perhaps there's a configuration issue on our solaris machines, though it's also 
possible this is just how it behaves in Solaris (at least with NIS).

As to whether anything should change for test_spwd -- I suspect this will get 
closed as "won't fix" but at least this report may help anyone else running 
into this failure.

--
components: Tests
messages: 285439
nosy: phantal
priority: normal
severity: normal
status: open
title: test_spwd fails on solaris using NIS users
type: behavior
versions: Python 3.6

___
Python tracker 

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



Re: Byte-run: a Python interpreter written in Python

2017-01-13 Thread BartC

On 13/01/2017 18:47, Ian Kelly wrote:

On Fri, Jan 13, 2017 at 11:07 AM, BartC  wrote:

Even when it turns out that the actual code on github is 1000 lines rather
than 500! Maybe it grew a bit since the 500 lines was quoted.


I assume they're excluding blank lines, comments and docstrings. And I
don't know whether the 500 lines is a hard limit or if there is a bit
of leeway there.



https://github.com/nedbat/byterun/blob/master/byterun/pyvm2.py

github reports 869 sloc from a total of 1044 lines.

But 1000 lines is still small compared with the 220,000 lines of CPython 
(and that was an old version) which is only the C code and nothing else.


If someone wants to experiment with the behaviour of a byte-code, they 
might be able to do with this project (I haven't tried), more easily 
than with the real thing.



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


[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2017-01-13 Thread Vinay Sajip

Vinay Sajip added the comment:

Patch uploaded herewith.

--
assignee:  -> vinay.sajip
stage:  -> patch review
Added file: http://bugs.python.org/file46283/issue-24875-01.diff

___
Python tracker 

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



[issue29261] Missing venv/scripts/common after "make install"

2017-01-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 077681e35577 by Vinay Sajip in branch '3.5':
Fixes #29261: added venv/scripts/common to LIBSUBDIRS.
https://hg.python.org/cpython/rev/077681e35577

New changeset f20b2073dd4a by Vinay Sajip in branch '3.6':
Fixes #29261: merged fix from 3.5.
https://hg.python.org/cpython/rev/f20b2073dd4a

New changeset b76c42656639 by Vinay Sajip in branch 'default':
Closed #29261: merged fix from 3.6.
https://hg.python.org/cpython/rev/b76c42656639

--
nosy: +python-dev
resolution:  -> fixed
stage: commit 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



[issue29197] Remove os.path.splitunc()

2017-01-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue29197] Remove os.path.splitunc()

2017-01-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2be38927ea61 by Serhiy Storchaka in branch 'default':
Issue #29197: Removed deprecated function ntpath.splitunc().
https://hg.python.org/cpython/rev/2be38927ea61

--
nosy: +python-dev

___
Python tracker 

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



[issue29267] Cannot override some flags in CFLAGS from the command-line

2017-01-13 Thread Brian Vandenberg

New submission from Brian Vandenberg:

Due to issue 29264 I was attempting to override the build default "-std=c99" 
with:

/path/to/configure (...) CFLAGS=-std=gnu99

... however, the configure script is written like this:

CFLAGS_NODIST="$CFLAGS_NODIST -std=c99"

This causes it to always override my attempt to override the build default.

--
components: Build
messages: 285435
nosy: phantal
priority: normal
severity: normal
status: open
title: Cannot override some flags in CFLAGS from the command-line
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue29197] Remove os.path.splitunc()

2017-01-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



Re: Byte-run: a Python interpreter written in Python

2017-01-13 Thread Ian Kelly
On Fri, Jan 13, 2017 at 11:07 AM, BartC  wrote:
> Even when it turns out that the actual code on github is 1000 lines rather
> than 500! Maybe it grew a bit since the 500 lines was quoted.

I assume they're excluding blank lines, comments and docstrings. And I
don't know whether the 500 lines is a hard limit or if there is a bit
of leeway there.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29266] test_create_connection_service_name fails if "http" isn't listed in /etc/services

2017-01-13 Thread Brian Vandenberg

New submission from Brian Vandenberg:

One of our solaris machines doesn't have an entry in /etc/services for "http".  
This is causing test_create_connection_service_name to fail.

In my case I can just ignore that particular failure, but as a fix you might 
consider overtly getting valid service names from the host to test.  
Additionally, if you don't already have it you might consider adding a test 
that validates behavior when using a non-existent service.

--
components: Tests
messages: 285434
nosy: phantal
priority: normal
severity: normal
status: open
title: test_create_connection_service_name fails if "http" isn't listed in 
/etc/services
type: behavior
versions: Python 3.6

___
Python tracker 

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



Re: Software to Control RGB Strips

2017-01-13 Thread Chris Angelico
On Sat, Jan 14, 2017 at 5:07 AM,   wrote:
> Hey all,
>
> I was debating on getting some RGB light strips for my room. I noticed, from 
> this tutorial:
>
> http://popoklopsi.github.io/RaspberryPi-LedStrip/#!/ws2812
>
>
> there is a  WS2812x library to run commands that control the RGB strip.
>
> Do I just need to download the WS2812x library, and, then, access that 
> library as I would, say, a header file in C++? In Pythons syntax, of course.
>
> Anything to get me pointed in the right direction would be greatly 
> appreciated! Thanks!

Pretty much, yeah. The Python syntax to do that is probably:

import ws2812

although a glance at the examples suggests that the package might be
called "neopixel" instead, which is a bit surprising.

You may be able to skip the download and compilation steps and just run this:

python3 -m pip install rpi_ws281x

I don't know anything about the library itself, but that's the normal
way to install more Python packages. You can find a full list of
packages you can install that way here:

https://pypi.python.org/pypi

There's a lot of them :)

Enjoy!

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


Re: Problem while building Python 3.6 from source.

2017-01-13 Thread Chris Angelico
On Sat, Jan 14, 2017 at 5:00 AM, Michael S  wrote:
> Hello,
> I am new to this mailing-list and I really don't know whether this
> mail should belong to python-dev. Please tell me, if so.

Hi and welcome! This kind of thing is best on this list initially.

> Unfortunately, I have got the following problem: I wanted to build and
> install Python 3.6 from source but did not succeed.
> To clarify my situation, I got as an operating system Debian jessie
> 8.6 and I used the xz compressed source tarball from
> https://www.python.org/downloads/release/python-360/.
> Concerning the build dependencies: I just executed:
> $ sudo apt-get build-dep python3.4 (since 3.6 and 3.5 did not work).

That should be fine; the build dependencies of Python don't tend to
change frequently. Jessie shipped with Python 3.4 but nothing newer,
so there won't be packages for python3.5 or python3.6.

> Then I executed ./configure --enable-optimizations and make -j4 (I got 4 
> cores).
> The output of make ended like:
> 'make: *** [profile-opt] Error 2'.

That just means that something went wrong. You'd have to scroll up to
find the actual cause of the error.

> I had redirected the output and error of the configure and make commands via
> $ make -j4 &> /home/username/make_output.txt.
> Nevertheless I got an error to the console:
> '*** Error in ./python'" free(): invalid next size (normal):
> 0x015bdf90 ***'.
> Due to these error messages (this one and the one at the end of make)
> I think the build was not successful.
>
> How to solve this problem?
>
> Of course I could send you the output and error files.

The first thing I'd do would be to try a non-optimized build. Set your
current build tree aside and re-extract into a new directory (that
way, when you go back to playing with optimized builds, you don't have
to redo the work), and run configure with no arguments. I'd also be
inclined to run make with no arguments; there've been issues with
parallel builds in enough projects that I've gotten into the habit of
"problem? do it the slow way". If that build also fails, scroll up a
bit and find where stuff failed.

Are you familiar with building programs from source? If not, the best
solution might be to post the entire log, but ideally, you should be
able to skim through the last part of the log and report the actual
problem that's cropping up.

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


[issue28911] Clarify the behaviour of assert_called_once_with

2017-01-13 Thread Lisa Roach

Lisa Roach added the comment:

It took me a little while to wrap my brain around this, but you are definitely 
right that the documentation is not sufficient, your changes are an 
improvement. 

My wonder is, should we change the documentation or be looking at the code 
itself? I have always interpreted the method as asserting that only one call 
was made with the matching signature. If I want to test for call count I can 
just assert mock.call_count == 1.

The code could instead look like this: 

def assert_called_once_with(_mock_self, *args, **kwargs):
self = _mock_self
if not self.mock_calls.count(call(*args, **kwargs)) == 1:
msg = ("Expected '%s' to be called once with %r %r. Called %s times."   
   % (self._mock_name or 'mock', args, kwargs, 
self.mock_calls.count(call(*args,  **kwargs
raise AssertionError(msg)


Then again, if users have been using this to assert that the call_count is one 
(which is likely since it is in the examples documentation), this change would 
break backwards functionality.

Thoughts?

--
nosy: +lisroach

___
Python tracker 

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



Re: Problem while building Python 3.6 from source.

2017-01-13 Thread Thomas Nyberg

On 01/13/2017 10:00 AM, Michael S wrote:

'*** Error in ./python'" free(): invalid next size (normal):
0x015bdf90 ***'.


Are you possibly running out of memory due to the extra concurrent 
compilations?


Cheers,
Thomas

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


Software to Control RGB Strips

2017-01-13 Thread brettsalyer
Hey all,

I was debating on getting some RGB light strips for my room. I noticed, from 
this tutorial:

http://popoklopsi.github.io/RaspberryPi-LedStrip/#!/ws2812


there is a  WS2812x library to run commands that control the RGB strip. Well, I 
wanted to, instead of running commands through a terminal, create a GUI using 
python, then exploit the library I mentioned above to create a piece of 
software that controls my lighting from my Raspberry Pi.

I was going to use Tkinter to create the GUI. 

Now, I'm a pretty beginner programmer, having only taken a C++ course and the 
Java course I'm in now.

Do I just need to download the WS2812x library, and, then, access that library 
as I would, say, a header file in C++? In Pythons syntax, of course.

Anything to get me pointed in the right direction would be greatly appreciated! 
Thanks!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Byte-run: a Python interpreter written in Python

2017-01-13 Thread BartC

On 13/01/2017 17:08, Ian Kelly wrote:

On Fri, Jan 13, 2017 at 3:46 AM, Steve D'Aprano
 wrote:


http://aosabook.org/en/500L/a-python-interpreter-written-in-python.html


Neat. But not really surprising IMO that it can fit into 500 lines,


If there are still 120 or so byte-codes, then that's just 4 lines on 
average to implement each byte-code, which is pretty good going.


Even when it turns out that the actual code on github is 1000 lines 
rather than 500! Maybe it grew a bit since the 500 lines was quoted.


But it's still 8 lines per byte-code.


since it doesn't handle compiling Python into bytecode (which is the
hard part)


I disagree that that's the hardest part. But it was probably not very 
interesting for this project. Implementing the runtime environment, the 
object system, type-dispatchers, error-handling, symbol tables, garbage 
collection and all the rest would be more challenging.



and doesn't include libraries. There doesn't seem to be
much purpose to this other than it being a toy project written for a
book.


Being educational would be enough of a point.

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


Problem while building Python 3.6 from source.

2017-01-13 Thread Michael S
Hello,
I am new to this mailing-list and I really don't know whether this
mail should belong to python-dev. Please tell me, if so.


Unfortunately, I have got the following problem: I wanted to build and
install Python 3.6 from source but did not succeed.
To clarify my situation, I got as an operating system Debian jessie
8.6 and I used the xz compressed source tarball from
https://www.python.org/downloads/release/python-360/.
Concerning the build dependencies: I just executed:
$ sudo apt-get build-dep python3.4 (since 3.6 and 3.5 did not work).
Then I executed ./configure --enable-optimizations and make -j4 (I got 4 cores).
The output of make ended like:
'make: *** [profile-opt] Error 2'.
I had redirected the output and error of the configure and make commands via
$ make -j4 &> /home/username/make_output.txt.
Nevertheless I got an error to the console:
'*** Error in ./python'" free(): invalid next size (normal):
0x015bdf90 ***'.
Due to these error messages (this one and the one at the end of make)
I think the build was not successful.

How to solve this problem?

Of course I could send you the output and error files.

I'd be glad at any help.
-MichaelS
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29265] test suite is attempting to spawn 258 child processes to run tests

2017-01-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +haypo

___
Python tracker 

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



[issue29265] test suite is attempting to spawn 258 child processes to run tests

2017-01-13 Thread Brian Vandenberg

Brian Vandenberg added the comment:

This is odd.  I just went back and re-ran 3.5.1 to see how many cores and it's 
having the same problem now.  So, scratch that last coment.

--

___
Python tracker 

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



[issue29265] test suite is attempting to spawn 258 child processes to run tests

2017-01-13 Thread Brian Vandenberg

Brian Vandenberg added the comment:

I forgot to mention, this wasn't an issue in 3.5.1 though I never did check how 
many jobs it was using.

I ran into other issues building that version and moved to a newer version 
because at least one of them (logging test race condition) was fixed after 
3.5.1.

--

___
Python tracker 

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



[issue29265] test suite is attempting to spawn 258 child processes to run tests

2017-01-13 Thread Brian Vandenberg

New submission from Brian Vandenberg:

I'm attempting to build python 3.6.0 on sparc/solaris 10.  After the initial 
configure/compile complete I ran "make test" and I see:

$ make test
running build
running build_ext
(...)
running build_scripts
copying and adjusting (...)
changing mode of (...)
renaming (...)
(...)
Run tests in parallel using 258 child processes


I'm fairly sure the issue stems from the fact that each core on the machine has 
8 "threads" and there's 32 cores (for a total of 256 virtual cores).

Each core can execute 8 parallel tasks only in very specific circumstances.  
It's intended for use by things like lapack/atlas where you might be doing many 
computations on the same set of data.

Outside of these more restricted circumstances each core can only handle 2 
parallel tasks (or so I gathered from the documentation), so at best this 
machine could handle 64 backgrounded jobs though I normally restrict my builds 
to the actual core count or less.

The most common way to get a "realistic" core count on these machines from 
shell scripts is:

$ core_count=`kstat -m cpu_info | grep core_id | sort -u | wc -l`

... though I'm not sure how the test suite is determining the core count.  I 
didn't see any mention of "kstat" anywhere.

--
components: Tests
messages: 285430
nosy: phantal
priority: normal
severity: normal
status: open
title: test suite is attempting to spawn 258 child processes to run tests
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue29241] sys._enablelegacywindowsfsencoding() don't apply to os.fsencode and os.fsdecode

2017-01-13 Thread JGoutin

JGoutin added the comment:

Yes, I reported this encoding issue to some of them.

But, there is still some problems : 
- Some libraries are not updated frequently (Or not still maintained), and 
still use fsencode.
- Tests and CI don't see this problem if they don't have a test case for 
filename with accents or other uncommon characters in english.

This problem will not be easy to eliminate totally...

--

___
Python tracker 

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



[issue29264] sparc/ffi.c:440 error: 'asm' undeclared

2017-01-13 Thread Brian Vandenberg

New submission from Brian Vandenberg:

When building pythong 3.6.0 on solaris 10/sparc I'm seeing the following error:

Modules/_ctypes/libffi/src/sparc/ffi.c:440:8: error: 'asm' undeclared (first 
use in this function)
(...)

If I force it to use -std=gnu99 then it seems to compile fine.

--
components: ctypes
messages: 285428
nosy: phantal
priority: normal
severity: normal
status: open
title: sparc/ffi.c:440 error: 'asm' undeclared
type: compile error
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



[issue19764] subprocess: use PROC_THREAD_ATTRIBUTE_HANDLE_LIST with STARTUPINFOEX on Windows Vista

2017-01-13 Thread Segev Finer

Segev Finer added the comment:

I have read some of https://github.com/rprichard/win32-console-docs and it 
documents quite a bunch of nastiness with PROC_THREAD_ATTRIBUTE_HANDLE_LIST in 
Windows Vista/7. Windows is so much fun sometimes :P

Essentially console handles in Windows before Windows 8 are user mode handles 
and not real kernel handles. Those user mode handles are inherited by a 
different mechanism than kernel handles and regardless of 
PROC_THREAD_ATTRIBUTE_HANDLE_LIST, and if passed in 
PROC_THREAD_ATTRIBUTE_HANDLE_LIST will cause it to fail in weird ways. Those 
user mode console handles have the lower two bits set. The lower two bits in 
Windows are reserved for tagging such special handles.

Also in all versions you can't pass in an empty handle list, but a list with 
just a NULL handle works fine.

See: 
https://github.com/rprichard/win32-console-docs/blob/master/src/HandleTests/CreateProcess_InheritList.cc

I attached a version of the patch with a hack around those issues based on what 
I read, but I can't test that it actually fixes the issues since I don't have a 
Windows Vista or 7 system around.

--
Added file: 
http://bugs.python.org/file46282/windows-subprocess-close-fds-v3-vista7-hack.patch

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-13 Thread STINNER Victor

STINNER Victor added the comment:

> Strange, I'm unable to reproduce the result on a different computer:
>
> haypo@smithers$ ./python -m perf compare_to ref.json tp_fastcall.json  -v
> Median +- std dev: [ref] 20.0 ms +- 0.5 ms -> [tp_fastcall] 20.0 ms +-
> 0.6 ms: 1.00x slower (+0%)
> Not significant!

Oops, I forgot to mention that I tried the telco benchmark.

--

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-13 Thread STINNER Victor

STINNER Victor added the comment:

Strange, I'm unable to reproduce the result on a different computer:

haypo@smithers$ ./python -m perf compare_to ref.json tp_fastcall.json  -v
Median +- std dev: [ref] 20.0 ms +- 0.5 ms -> [tp_fastcall] 20.0 ms +-
0.6 ms: 1.00x slower (+0%)
Not significant!

--

___
Python tracker 

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



[issue29241] sys._enablelegacywindowsfsencoding() don't apply to os.fsencode and os.fsdecode

2017-01-13 Thread STINNER Victor

STINNER Victor added the comment:

Hum, it was long time ago since I worked on Windows. Well, Python has a "mbcs" 
codec which uses the ANSI code page which exists like "forever". These 
libraries should be patched to use "mbcs" instead of 
sys.getfilesystemencoding().

--

___
Python tracker 

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



Re: Byte-run: a Python interpreter written in Python

2017-01-13 Thread Ian Kelly
On Fri, Jan 13, 2017 at 3:46 AM, Steve D'Aprano
 wrote:
>
> http://aosabook.org/en/500L/a-python-interpreter-written-in-python.html

Neat. But not really surprising IMO that it can fit into 500 lines,
since it doesn't handle compiling Python into bytecode (which is the
hard part) and doesn't include libraries. There doesn't seem to be
much purpose to this other than it being a toy project written for a
book.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29241] sys._enablelegacywindowsfsencoding() don't apply to os.fsencode and os.fsdecode

2017-01-13 Thread STINNER Victor

STINNER Victor added the comment:

> Temporary fixing issues with some third party libraries which use C code for 
> files I/O (With filename as "mbcs" encoded bytes internally).
>
> Theses libraries generally call 
> "filename.encode(sys.getfilesystemencoding())" or "os.fsencode(filename)" 
> before sending filenames from Python to C code.

Hum, Python lacks a function to encode to/decode from the ANSI code page, 
something like codecs.code_page_encode() / code_page_decode() with CP_ACP. It 
would allow to get the same encoding in UTF-8 and legacy modes.

--

___
Python tracker 

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



[issue29261] Missing venv/scripts/common after "make install"

2017-01-13 Thread Zachary Ware

Zachary Ware added the comment:

LGTM.

--
assignee:  -> vinay.sajip
nosy: +vinay.sajip, zach.ware
stage:  -> commit review

___
Python tracker 

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



[issue29241] sys._enablelegacywindowsfsencoding() don't apply to os.fsencode and os.fsdecode

2017-01-13 Thread JGoutin

JGoutin added the comment:

Personally, I call "sys._enablelegacywindowsfsencoding()" for only one reason :
Temporary fixing issues with some third party libraries which use C code for 
files I/O (With filename as "mbcs" encoded bytes internally).

Theses libraries generally call "filename.encode(sys.getfilesystemencoding())" 
or "os.fsencode(filename)" before sending filenames from Python to C code.

Actually, I didn't see any side effect for using this function. Maybe because I 
call it at start before anything else.

Using the environment variable is not easy in my case.


I can look if encoding caching in fsencode is efficient (On Windows). And 
eventually propose a code change for this.

--

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-13 Thread STINNER Victor

STINNER Victor added the comment:

I ran benchmarks on tp_fastcall.patch. Hum, it seems like there is a 
performance issue somewhere :-( Almost all benchmarks are much slower with the 
patch.

haypo@speed-python$ python3 -m perf compare_to 
2017-01-11_00-07-default-b9404639a18c.json tp_fastcall_ref_b9404639a18c.json -G
Slower (63):
- unpickle_pure_python: 671 us +- 16 us -> 952 us +- 9 us: 1.42x slower (+42%)
- pickle_pure_python: 1.02 ms +- 0.02 ms -> 1.40 ms +- 0.02 ms: 1.37x slower 
(+37%)
- telco: 16.6 ms +- 0.6 ms -> 22.7 ms +- 0.3 ms: 1.37x slower (+37%)
- xml_etree_generate: 215 ms +- 3 ms -> 290 ms +- 7 ms: 1.35x slower (+35%)
- hexiom: 17.7 ms +- 0.2 ms -> 23.6 ms +- 0.1 ms: 1.33x slower (+33%)
- xml_etree_process: 182 ms +- 3 ms -> 240 ms +- 4 ms: 1.32x slower (+32%)
- genshi_text: 69.0 ms +- 0.8 ms -> 90.4 ms +- 0.8 ms: 1.31x slower (+31%)
- logging_simple: 27.5 us +- 0.4 us -> 35.8 us +- 0.4 us: 1.30x slower (+30%)
(...)

Faster (1):
- spectral_norm: 271 ms +- 2 ms -> 257 ms +- 2 ms: 1.06x faster (-5%)

--

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-13 Thread STINNER Victor

STINNER Victor added the comment:

Ok, I pushed a new commit "Add Py_TPFLAGS_HAVE_FASTCALL flag" in my Git branch.

(By the way, I'm using the Git branch as a working copy, it can change anytime 
to get a nice list of commits. If you want reliable changes, use patches 
attached to this issue.)


Serhiy Storchaka!:
> For compatibility with extensions built with older Pythons you should define 
> new type flag and read tp_fastcall only if the flag is set. See for example 
> Py_TPFLAGS_HAVE_FINALIZE.

Wait, there is maybe an issue with the stable API in my design :-/

Let's say that a builtin type NEW defines tp_fastcall and uses 
fastcall_wrapper() for tp_call. A type OLD inherits from NEW and don't override 
tp_call (not tp_fastcall). Type OLD comes from an extension compiled with 
Python 3.6 and use the stable ABI. Does the type OLD contain the field 
tp_fastcall in memory? Is it possible to copy the tp_fastcall filed from type 
NEW into the type OLD?

If not, the fastcall_wrapper() should be smarter to not get tp_fastcall from 
the type OLD but follow the MRO to find the first type with the 
Py_TPFLAGS_HAVE_FASTCALL flag. Is it possible that this short loop to find has 
a cost on performances?

--

___
Python tracker 

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



[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2017-01-13 Thread Thomas Nyberg

Thomas Nyberg added the comment:

Hi Vinay,

You should probably upload a patch with the changes you made (however trivial) 
if you want that version considered. Makes it easier to comment and can then 
point to it for others to consider.

Cheers,
Thomas

--

___
Python tracker 

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



[issue29260] Use designated initializers to define PyTypeObject types

2017-01-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is nothing about this in PEP 7, but I think it would be better to use 
common subset of C and C++. This would allow to migrate to the subset of C++ in 
future. It is sad that PEP 7 allows C99 features not compatible with C++.

--

___
Python tracker 

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



[issue29259] Add tp_fastcall to PyTypeObject: support FASTCALL calling convention for all callable objects

2017-01-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

PyArg_UnpackStack() is declared as in the limited API since 3.3. If you want to 
add PyArg_UnpackStack() to the limited API, define it as added in 3.7.

For compatibility with extensions built with older Pythons you should define 
new type flag and read tp_fastcall only if the flag is set. See for example 
Py_TPFLAGS_HAVE_FINALIZE.

--

___
Python tracker 

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



[issue29263] Implement LOAD_METHOD/CALL_METHOD for C functions

2017-01-13 Thread STINNER Victor

Changes by STINNER Victor :


--
dependencies: +Add tp_fastcall to PyTypeObject: support FASTCALL calling 
convention for all callable objects

___
Python tracker 

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



[issue26110] Speedup method calls 1.2x

2017-01-13 Thread STINNER Victor

STINNER Victor added the comment:

I just created the issue #29263: "Implement LOAD_METHOD/CALL_METHOD for C 
functions".

--

___
Python tracker 

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



[issue29263] Implement LOAD_METHOD/CALL_METHOD for C functions

2017-01-13 Thread STINNER Victor

New submission from STINNER Victor:

The issue #29259 implements tp_fastcall on method_descriptor 
(PyMethodDescr_Type). According to http://bugs.python.org/issue26110#msg283093 
it would allow to implement LOAD_METHOD and CALL_METHOD for C functions.

--
messages: 285414
nosy: haypo, inada.naoki, yselivanov
priority: normal
severity: normal
status: open
title: Implement LOAD_METHOD/CALL_METHOD for C functions
type: performance
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



[issue29260] Use designated initializers to define PyTypeObject types

2017-01-13 Thread STINNER Victor

STINNER Victor added the comment:

> Designated initializers already are used in _asynciomodule.c.

Oh, I didn't notice. Since I don't recall any bug report on compilation failing 
on this module, I guess that it's fine to start to use them in more code.

> But this is one of C99 features that are not compatible with C++. Using them 
> makes harder possible using C++ compiler in future.

Hum, what kind of issue? With which compiler? What is it in the PEP 7 in this 
case?

--
nosy: +benjamin.peterson, yselivanov

___
Python tracker 

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



[issue29260] Use designated initializers to define PyTypeObject types

2017-01-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Designated initializers already are used in _asynciomodule.c. But this is one 
of C99 features that are not compatible with C++. Using them makes harder 
possible using C++ compiler in future.

--

___
Python tracker 

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



[issue29262] Provide a way to check for *real* typing.Union instances

2017-01-13 Thread flying sheep

New submission from flying sheep:

typing.Union prevents the use of `isinstance` and `issubclass` via a hook.

This is presumably to prevent errors that would arise if someone tried to do 
issubclass(A, Union[A, B]) or isinstance(A(), Union[A, B]), because Union isn’t 
specified in the PEP to allow a check like this, and doesn’t implement it. 
(Instead it throws said error)

However, as far as I can see there is no blessed way to check if an object was 
returned by Union.__getitem__(). A simple way that works is:

sig = inspect.signature(f)
ann = sig.parameters['arg1'].annotation
is_an_union = isinstance(ann, typing._Union)

but _Union is a private class, and an implementation detail.

is there a blessed way to do this? If not, one should be added.

--
components: Library (Lib)
messages: 285410
nosy: flying sheep
priority: normal
severity: normal
status: open
title: Provide a way to check for *real* typing.Union instances
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



  1   2   >