[issue28662] catch also PermissionError in tests when spawning a non existent program

2016-11-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
assignee:  -> xdegaye
nosy: +serhiy.storchaka
stage: patch review -> commit review

___
Python tracker 

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



[issue28654] sys.stdout.isatty() returns True even if redirected to NUL

2016-11-10 Thread Kuno Meyer

Kuno Meyer added the comment:

2) Yes, it should be `> /dev/null` instead of `> /dev/nul` (my bad). The output 
remains the same.

--

___
Python tracker 

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



[issue26786] bdist_msi duplicates directories with names in ALL CAPS to a bogus location

2016-11-10 Thread Ivan Pozdeev

Changes by Ivan Pozdeev :


Removed file: http://bugs.python.org/file42496/bdist_msi.patch

___
Python tracker 

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



[issue26786] bdist_msi duplicates directories with names in ALL CAPS to a bogus location

2016-11-10 Thread Ivan Pozdeev

Changes by Ivan Pozdeev :


Added file: http://bugs.python.org/file45437/bdist_msi.patch

___
Python tracker 

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



[issue28661] Fix code example in Python 3.5 telnetlib documentation

2016-11-10 Thread Ivan Tomilov

Ivan Tomilov added the comment:

I see, thanks for the clarification.
But in my OS X the things are different and I spent about 1 hour trying
this code to take off.
Maybe it's better to change this code to avoid spending time for such
subtle bugs? Say:
tn.read_until(b"Password:")
tn.read_eager()

Or just add a comment. It's confusing when one takes code from the official
website and it doesn't work.

What do you think?

On 11 November 2016 at 02:05, R. David Murray 
wrote:

>
> R. David Murray added the comment:
>
> Well, the example code is correct for a typical telnet service running on
> a unix variant.  That will output a space after the colon, so that the
> user's input is separated from the colon when they start to type.
>
> --
> nosy: +r.david.murray
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue23839] Clear caches after every test

2016-11-10 Thread Raymond Hettinger

Raymond Hettinger added the comment:

LGTM.

--
nosy: +rhettinger

___
Python tracker 

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



Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread eryk sun
On Fri, Nov 11, 2016 at 6:01 AM, Thorsten Kampe
 wrote:
> * eryk sun (Thu, 10 Nov 2016 23:04:02 +)
>>
>> On Thu, Nov 10, 2016 at 9:58 PM, Thorsten Kampe
>>  wrote:
>> >
>> > I'm trying to run a script with a different Python version by
>> > extending the path variable and executing "python.exe". It looks like
>> > subprocess will always run the current executing Python.
>>
>> WinAPI CreateProcess checks the application directory, current
>> directory (an insecure legacy default), %SystemRoot%\System32,
>> %SystemRoot%\System, %SystemRoot%, and then the directories in %PATH%.
>> This is listed in the documentation of the lpCommandLine parameter on
>> MSDN [1].
>
> I'm aware of that. Python is in F:\PortableApps\Python3x and neither
> the current directory nor the PATH points to that.

That's the application directory, which is the first place
CreateProcess looks (via the SearchPath call), as both of my examples
shows. In my case python.exe is located in the standard 3.5 system
installation path, "C:\Program Files\Python35".

I showed how to remove the current directory from the search. But, in
hindsight, I should have clarified that the working directory was not
related to your problem. It's just the only directory that can be
removed from the implicit search path (AFAIK). I thought about
replying with a clarification, but it seemed clear in context that the
source of the behavior was the application directory.

I know of no API, environment variable, or manifest setting to remove
the application directory from the head of the search path used by
CreateProcess. What you can do is call SearchPath explicitly (via
PyWin32 or ctypes) with just %Path%, or do the search in pure Python
via shutil.which.

Note also that LoadLibrary uses a separate DLL search path that also
defaults to preferring the application directory, but this can be
controlled by calling SetDefaultDllDirectories [1], among other
strategies.

[1]: https://msdn.microsoft.com/en-us/library/hh310515
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thorsten Kampe
* Thomas Nyberg (Thu, 10 Nov 2016 17:46:06 -0500)
> 
> On 11/10/2016 05:32 PM, Thorsten Kampe wrote:
> > Yes. That works. But it's not like subprocess should work.
> >
> 
> It certainly is odd. I can at least confirm that when I try to run your 
> code I get the error that you're expecting, but I run debian.
> 
> Have you tried using os.unsetenv()?

I think you are kind of misunderstanding my intention. I'm actually 
trying the opposite: running python.exe by setting F:\PortableApps
\Python3x as the first element in PATH. No Python interpreter is in 
my PATH. So unsetting PATH is just a way to demonstrate that this 
should never ever work.

I'm going to open a bug report.

Thorsten

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


Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thorsten Kampe
* eryk sun (Thu, 10 Nov 2016 23:04:02 +)
> 
> On Thu, Nov 10, 2016 at 9:58 PM, Thorsten Kampe
>  wrote:
> >
> > I'm trying to run a script with a different Python version by
> > extending the path variable and executing "python.exe". It looks like
> > subprocess will always run the current executing Python.
> 
> WinAPI CreateProcess checks the application directory, current
> directory (an insecure legacy default), %SystemRoot%\System32,
> %SystemRoot%\System, %SystemRoot%, and then the directories in %PATH%.
> This is listed in the documentation of the lpCommandLine parameter on
> MSDN [1].

I'm aware of that. Python is in F:\PortableApps\Python3x and neither 
the current directory nor the PATH points to that.

Thorsten

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


[issue21145] Add the @cached_property decorator

2016-11-10 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

2016-11-10 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thanks Nick.  I'm going to mark this as closed, as the proposal to microscopic 
to warrant incurring technical debt.

If someone comes forward with more fully formed idea for code generation or 
overall structural enchancement, that can be put in another tracker item.

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

___
Python tracker 

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



[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

2016-11-10 Thread Nick Coghlan

Nick Coghlan added the comment:

I'll echo Raymond's concerns here, as we simply don't have the collective 
maintenance capacity to sustain a plethora of special case micro-optimisations 
aimed at avoiding importing common standard library modules.

I will note however, that there has been relatively little work done on 
optimising CPython's code generator, as the use of pyc files and the fact 
namedtuples are typically only defined at start-up already keeps it out of the 
critical path in most applications.

While work invested there would technically still be a micro-optimisation at 
the language level, it would benefit more cases than just avoiding the use of 
namedtuple in functools would.

Alternatively, rather than manually duplicating the namedtuple code and having 
to keep it in sync by hand, you could investigate the work Larry Hastings has 
already done for Argument Clinic in Python's C files: 
https://docs.python.org/3/howto/clinic.html

Argument Clinic already includes the machinery necessary to assist with 
automated maintenance of generated code (at least in C), and hence could 
potentially be adapted to the task of "named tuple inlining". If Victor's AST 
transformation pipeline and function guard proposals in PEP's 511 and 510 are 
accepted at some point in the future, then such inlining could potentially even 
be performed implicitly some day.

Caring about start-up performance is certainly a good thing, but when 
considering potential ways to improve the situation, structural enhancements to 
the underlying systems are preferable to ad hoc special cases that complicate 
future development efforts.

--

___
Python tracker 

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



[issue28637] Python startup performance regression

2016-11-10 Thread Guido van Rossum

Guido van Rossum added the comment:

I think it's okay to add `enum` back into `re`.

--

___
Python tracker 

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



[issue28637] Python startup performance regression

2016-11-10 Thread Ethan Furman

Ethan Furman added the comment:

Leaving `re` out of site.py is fine; the current question is whether to add 
`enum` back to `re`.

--

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-10 Thread STINNER Victor

STINNER Victor added the comment:

I tried different patches and ran many quick & dirty benchmarks.

I tried to use likely/unlikely macros (using GCC __builtin__expect): the effect 
is not significant on call_simple microbenchmark. I gave up on this part.

__attribute__((hot)) on a few Python core functions fixes the major slowdown on 
call_method on the revision 83877018ef97 (described in the initial message).

I noticed tiny differences when using __attribute__((hot)), speedup in most 
cases. I noticed sometimes slowdown, but very small (ex: 1%, but 1% on a 
microbenchmark doesn't mean anything).

I pushed my patch to try to keep stable performance when Python is not compiled 
with PGO.

If you would like to know more about the crazy effect of code placement in 
modern Intel CPUs, I suggest you to see the slides of this recent talk from an 
Intel engineer:
https://llvmdevelopersmeetingbay2016.sched.org/event/8YzY/causes-of-performance-instability-due-to-code-placement-in-x86
"Causes of Performance Swings Due to Code Placement in IA by Zia Ansari 
(Intel), November 2016"

--

About PGO or not PGO: this question is not simple, I suggest to discuss it in a 
different place to not flood this issue ;-)

For my use case, I'm not convinced yet that PGO with our current build system 
produce reliable performance.

Not all Linux distributions compile Python using PGO: Fedora and RHEL don't 
compile Python using PGO for example. Bugzilla for Fedora:
https://bugzilla.redhat.com/show_bug.cgi?id=613045

I guess that there also some developers running benchmarks on Python compiled 
with "./configure && make". I'm trying to enhance documentation and tools 
around Python benchmarks to advice developers to use LTO and/or PGO.

--

___
Python tracker 

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



what is the procedure or how to plan how many nodes of dispy need for dsolve differential system in amazon cloud in limited time such as 1 hour, 2 hours.etc

2016-11-10 Thread meInvent bbird
what is the procedure or how to plan how many nodes of dispy need for dsolve 
differential system in amazon cloud in limited time such as 1 hour, 2 hours.etc 
?


#For Amazon Linux, the user name is ec2-user. For RHEL5, the user name is 
either root or ec2-user. 
#For Ubuntu, the user name is ubuntu. For Fedora, the user name is either 
fedora or ec2-user. 
#For SUSE Linux, the user name is either root or ec2-user. 
#Otherwise, if ec2-user and root don't work, check with your AMI provider.

import random, dispy
import ast 
from __future__ import division 
from sympy import * 
x, y, z, t = symbols('x y z t') 
k, m, n = symbols('k m n', integer=True) 
f, g, h = symbols('f g h', cls=Function) 
import inspect 

def compute(n): # executed on nodes
import random, time, socket
name = socket.gethostname()
cur_best = 1
for ii in range(n[0],n[0]):
for jj in range(n[1],n[1]):
for kk in range(n[2],n[3],100):  
#assume dsolve with sympy for differential system   
dispy_provisional_result((name, r))
cur_best = r
time.sleep(0.1)
# final result
return (name, cur_best)

def job_callback(job): # executed at the client
if job.status == dispy.DispyJob.ProvisionalResult:
#if job.result[1] < 0.005:
# acceptable result; terminate jobs
print('%s computed: %s %s %s %s' % (job.result[0], job.result[1], 
job.result[2], job.result[3], job.result[4]))
# 'jobs' and 'cluster' are created in '__main__' below
for j in jobs:
if j.status in [dispy.DispyJob.Created, dispy.DispyJob.Running,
dispy.DispyJob.ProvisionalResult]:
cluster.cancel(j)

if __name__ == '__main__':
#cluster = dispy.JobCluster(compute, callback=job_callback)
cluster = dispy.JobCluster(compute, 
nodes=['ec2-35-162-137-237.us-west-2.compute.amazonaws.com'], 
ip_addr='127.0.0.1', port=51347, node_port=51348, callback=job_callback, 
keyfile=r"C:\Users\hello\datacenterusekey.ppk")
jobs = []
prevk = 1
count = 0
for ii in range(1,2):
for jj in range(1,2000):
for kk in range(1,2000,100):
if ii < jj and jj < kk:
job = cluster.submit([ii,jj,prevk,kk])
prevk = kk
if job is None:
print('creating job %s failed!' % n)
continue
job.id = count
count = count + 1
jobs.append(job)
cluster.wait()
cluster.print_status()
cluster.close()
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I want to insert beacon scan result in to a database using python and mysql

2016-11-10 Thread Michael Torrie
On 11/10/2016 06:10 PM, Dennis Lee Bieber wrote:
> {I could swear I'd included an example of a parameterized query in my
> response... I didn't want to go into the details of "SQL injection attack"
> as, based on the rest of the OPs post, it would have needed a large
> explanation... And the biggest flaw was improper indentation for the
> database access}

You did indeed.  My bad.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28658] MacOsX idle don't run

2016-11-10 Thread Andrew Kontokanis

Changes by Andrew Kontokanis :


--
nosy: +ned.deily

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 59b91b4e9506 by Victor Stinner in branch 'default':
Issue #28618: Make hot functions using __attribute__((hot))
https://hg.python.org/cpython/rev/59b91b4e9506

--
nosy: +python-dev

___
Python tracker 

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



[issue27854] Installed 2.7: IDLE Help disabled because help.html is missing

2016-11-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Does attached file look correct?

--
keywords: +patch
stage:  -> commit review
Added file: http://bugs.python.org/file45436/add_idle_help.diff

___
Python tracker 

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



[issue25507] IDLE: user code 'import tkinter; tkinter.font' should fail

2016-11-10 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
status: open -> closed

___
Python tracker 

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



[issue25507] IDLE: user code 'import tkinter; tkinter.font' should fail

2016-11-10 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Import is only needed for the warning issued when someone using IDLE 2.x puts a 
non-ascii character into code being edited and tries to save without adding an 
encoding declaration.  
https://stackoverflow.com/questions/40523932/idle-2-7-11-12-nameerror-global-name-toplevel-is-not-defined

--

___
Python tracker 

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



Re: Fwd: Error message

2016-11-10 Thread MRAB

On 2016-11-10 21:37, Keenan C wrote:

To whom this may concern,

I am continuously receiving this error after the installation of Python
3.5.2.  The purpose of using this program is for a class I am currently
enrolled in at a University.  (I am running Windows 7 Home Premium 64-bit
paired with an i3-2100 processor and 6 gb of ram.  I don't believe the
specifications are a problems but I have listed them just in case.)
 Although this computer is not new, it has recently been factory reset.  I
have tried multiple times installing and uninstalling this program and
restarting the computer.  If you would be able to help me figure this out,
I would very much appreciate it.

Thank you,
Keenan Chu
[image: Inline image 1]

This list doesn't support attachments, so I'm guessing that it's 
complaining that it can't find "api-ms-win-crd-runtime-l1-1-0.dll".


You should already have it if you've kept your PC up to date via Windows 
Update, but if you haven't, read this:


https://support.microsoft.com/en-us/kb/3118401

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


[issue25507] IDLE: user code 'import tkinter; tkinter.font' should fail

2016-11-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 137c7b92360e by Terry Jan Reedy in branch '2.7':
Issue #25507: Add back import needed for 2.x encoding warning box.
https://hg.python.org/cpython/rev/137c7b92360e

--
status: pending -> open

___
Python tracker 

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



Re: Error message

2016-11-10 Thread eryk sun
On Thu, Nov 10, 2016 at 9:37 PM, Keenan C  wrote:
>
> I am continuously receiving this error after the installation of Python
> 3.5.2.  The purpose of using this program is for a class I am currently
> enrolled in at a University.  (I am running Windows 7 Home Premium 64-bit
> paired with an i3-2100 processor and 6 gb of ram.  I don't believe the
> specifications are a problems but I have listed them just in case.)
>  Although this computer is not new, it has recently been factory reset.  I
> have tried multiple times installing and uninstalling this program and
> restarting the computer.
>
> [image: Inline image 1]

python-list is text-only and drops message attachments. Please copy
and paste or transcribe the error message text and error code.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28637] Python startup performance regression

2016-11-10 Thread STINNER Victor

STINNER Victor added the comment:

Oh nice, python_startup benchmark at Nov 10 (rev at 8ebaa546a033) is now faster 
than python_startup at Feb 29 (rev dfeadfb4c8cc): new 16.8 ms, old 19.5. And 
it's much before when I opened the issue: 26.6 ms. Thanks.

https://speed.python.org/timeline/#/?exe=4=python_startup=1=50=off=on=on

The main difference is the removal of "import re" from Lib/site.py. If I added 
back "import re", python_startup comes back to 24.2 ms +- 0.0 ms. I understand 
that "import re" adds 7.4 ms. Any additional import has an important cost of 
python startup performance :-/

--

___
Python tracker 

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



[issue28662] catch also PermissionError in tests when spawning a non existent program

2016-11-10 Thread Xavier de Gaye

New submission from Xavier de Gaye:

This is yet another idiosyncrasy of Android, the /sbin directory is in the 
$PATH of the adb shell used for running the tests on the emulator or on a 
device connected with usb to the build platform, and /sbin is readable and 
searchable only by root. For a plain user, the loop over exec_array[] in 
child_exec() at _posixsubprocess.c sets saved_errno to EACCES after failing to 
exec /sbin/some_non_existent_program.

The patch fixes these failing tests on Android API 24: test_dtrace test_shutil 
test_subprocess.

--
components: Tests
files: catch_PermissionError.patch
keywords: patch
messages: 280551
nosy: xdegaye
priority: normal
severity: normal
stage: patch review
status: open
title: catch also PermissionError in tests when spawning a non existent program
type: behavior
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45435/catch_PermissionError.patch

___
Python tracker 

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



[issue28591] imghdr doesn't recognize some jpeg formats

2016-11-10 Thread Raul

Raul added the comment:

New patch for imghdr bug, including unittets. This patch works on python 2.7

--
Added file: http://bugs.python.org/file45434/imghdr_py27.patch

___
Python tracker 

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



[issue28661] Fix code example in Python 3.5 telnetlib documentation

2016-11-10 Thread R. David Murray

R. David Murray added the comment:

Well, the example code is correct for a typical telnet service running on a 
unix variant.  That will output a space after the colon, so that the user's 
input is separated from the colon when they start to type.

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



Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread eryk sun
On Thu, Nov 10, 2016 at 9:58 PM, Thorsten Kampe
 wrote:
>
> I'm trying to run a script with a different Python version by
> extending the path variable and executing "python.exe". It looks like
> subprocess will always run the current executing Python.

WinAPI CreateProcess checks the application directory, current
directory (an insecure legacy default), %SystemRoot%\System32,
%SystemRoot%\System, %SystemRoot%, and then the directories in %PATH%.
This is listed in the documentation of the lpCommandLine parameter on
MSDN [1].

Let's take a look with a breakpoint set on WinAPI SearchPath [2]:

>>> subprocess.Popen('python -c 42').wait()
Breakpoint 0 hit
KERNELBASE!SearchPathW:
7fff`4b344f60 488bc4  mov rax,rsp

In the x64 ISA, the lpPath parameter is passed in register rcx:

0:000> du @rcx L4D
0241`9a74dbe0  "C:\Program Files\Python35;.;C:\W"
0241`9a74dc20  "indows\SYSTEM32;C:\Windows\syste"
0241`9a74dc60  "m;C:\Windows;"
0:000> g
0

Note that the second entry is ".", which is the current directory.
Setting %NoDefaultCurrentDirectoryInExePath% [3] removes the current
directory from the search path:

>>> os.environ['NoDefaultCurrentDirectoryInExePath'] = '1'
>>> subprocess.Popen('python -c 42').wait()
Breakpoint 0 hit
KERNELBASE!SearchPathW:
7fff`4b344f60 488bc4  mov rax,rsp

0:000> du @rcx L4B
0241`99e43f90  "C:\Program Files\Python35;C:\Win"
0241`99e43fd0  "dows\SYSTEM32;C:\Windows\system;"
0241`99e44010  "C:\Windows;"

[1]: https://msdn.microsoft.com/en-us/library/ms682425
[2]: https://msdn.microsoft.com/en-us/library/aa365527
[3]: https://msdn.microsoft.com/en-us/library/ms684269
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thomas Nyberg

On 11/10/2016 05:32 PM, Thorsten Kampe wrote:

Yes. That works. But it's not like subprocess should work.



It certainly is odd. I can at least confirm that when I try to run your 
code I get the error that you're expecting, but I run debian.


Have you tried using os.unsetenv()?

https://docs.python.org/2/library/os.html#os.unsetenv

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


Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thorsten Kampe
* Thomas Nyberg (Thu, 10 Nov 2016 17:07:35 -0500)
> 
> On 11/10/2016 04:58 PM, Thorsten Kampe wrote:
> > Hi,
> >
> > I'm trying to run a script with a different Python version by
> > extending the path variable and executing "python.exe". It looks like
> > subprocess will always run the current executing Python.
> >
>  > [...]
>  >
> > Thorsten
> >
> 
> Have you tried using the full path to the other binary?

Yes. That works. But it's not like subprocess should work.

Thorsten

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


Re: Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thomas Nyberg

On 11/10/2016 04:58 PM, Thorsten Kampe wrote:

Hi,

I'm trying to run a script with a different Python version by
extending the path variable and executing "python.exe". It looks like
subprocess will always run the current executing Python.


> [...]
>

Thorsten



Have you tried using the full path to the other binary?

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


Windows: subprocess won't run different Python interpreter

2016-11-10 Thread Thorsten Kampe
Hi,

I'm trying to run a script with a different Python version by 
extending the path variable and executing "python.exe". It looks like 
subprocess will always run the current executing Python.

The following snippet demonstrates the problem:
"""
import os, subprocess
os.environ['PATH'] = ''
print(subprocess.check_output(['python.exe', '-V']))
"""

It outputs the version of the current executing Python interpreter 
although it should generate an error because Python is not in the 
PATH.

Thorsten

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


[issue28635] Update What's New for 3.6

2016-11-10 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

I spotted a small typo in the "PEP 495: Local Time Disambiguation" section: 
"The values of the fold attribute have the value 0 all instances ..." should be 
"The values of the fold attribute have the value 0 *for* all instances ..."

--
nosy: +belopolsky

___
Python tracker 

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



[issue21145] Add the @cached_property decorator

2016-11-10 Thread Carl Meyer

Carl Meyer added the comment:

How do you propose that slots should be supported?

Part of the value of cached_property is that cached access is a normal Python 
attribute access with no function call overhead. I am not interested in adding 
support for slots if it loses that benefit. I would not use such an 
implementation myself.

I may be missing some option, but I can't see how to add slots support without 
losing that benefit, because it requires the ability to store an instance 
attribute under the same name as the descriptor, taking advantage of the fact 
that instance dict overrides a non-data descriptor.

This implementation of cached_property has been in wide use in multiple very 
popular projects for many years. The fact that none of those implementations 
have ever needed to add slots support suggests that it isn't actually that 
important.

If you have an idea for how to support slots without making cached_property 
less valuable for the common case, please share it and I am willing to 
implement it.

Otherwise, I propose that this implementation which is already proved in wide 
usage should be added to the stdlib; I can add a documentation note that 
objects with slots are not supported. If there is demand for 
cached_property_with_slots, it can be added separately.

--

___
Python tracker 

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



Fwd: Error message

2016-11-10 Thread Keenan C
To whom this may concern,

I am continuously receiving this error after the installation of Python
3.5.2.  The purpose of using this program is for a class I am currently
enrolled in at a University.  (I am running Windows 7 Home Premium 64-bit
paired with an i3-2100 processor and 6 gb of ram.  I don't believe the
specifications are a problems but I have listed them just in case.)
 Although this computer is not new, it has recently been factory reset.  I
have tried multiple times installing and uninstalling this program and
restarting the computer.  If you would be able to help me figure this out,
I would very much appreciate it.

Thank you,
Keenan Chu
[image: Inline image 1]
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28591] imghdr doesn't recognize some jpeg formats

2016-11-10 Thread Raul

Raul added the comment:

The issue16512 don't solve the problem, note how the patch it provide fails to 
detect all the valid JPEG images attached in this issue.

--

___
Python tracker 

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



[issue28591] imghdr doesn't recognize some jpeg formats

2016-11-10 Thread Raul

Raul added the comment:

Image used in the unit-tests of previous patch.
Add it under Lib/test/imghdrdata/python1.jpg

--
Added file: http://bugs.python.org/file45433/python1.jpg

___
Python tracker 

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



[issue28591] imghdr doesn't recognize some jpeg formats

2016-11-10 Thread Raul

Raul added the comment:

New patch for imghdr bug, including unittets. This patch works on python 3.x

--
Added file: http://bugs.python.org/file45432/imghdr_py3.patch

___
Python tracker 

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



[issue28638] Creating namedtuple is too slow to be used in common stdlib (e.g. functools)

2016-11-10 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> half a millisecond is reduced.

I would like to caution against any significant changes to save microscopic 
amounts of time.  Twisting the code into knots for minor time savings is rarely 
worth it and it not what Python is all about.

> Half milliseconds is small, but it isn't negligible on some situation.

I would say that it is almost always negligible and reflects a need for a 
better sense of proportion and perspective.

Also, in the past we've found that efforts to speed start-up time were 
measurable only in trivial cases.  Tools like mercurial end-up importing and 
using a substantial chunk of the standard library anyway, so those tools got 
zero benefit from the contortions we did to move _collections_abc.py from 
underneath the collections module.

In the case of functools, if the was a real need (and I don't believe there 
is), I would be willing to accept INADA's original patch replacing the 
namedtuple call with its source.

That said, I don't think half millisecond is worth the increase in code volume 
and the double maintenance problem keeping it in-sync with any future changes 
to namedtuple.   In my opinion, accumulating technical debt in this fashion is 
a poor software design practice.

--

___
Python tracker 

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



[issue21145] Add the @cached_property decorator

2016-11-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The decorator should support classes with __slots__.

--

___
Python tracker 

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



[issue21145] Add the @cached_property decorator

2016-11-10 Thread Carl Meyer

Carl Meyer added the comment:

Attaching a patch with the simplest version of cached_property (tehnique is not 
original, similar code is found in Django, Bottle, Flask, the cached_property 
lib, and many other places).

--
components: +Library (Lib)
keywords: +patch
versions: +Python 3.7 -Python 3.6
Added file: http://bugs.python.org/file45431/cached_property.diff

___
Python tracker 

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



[issue28644] Document recent changes in typing.py

2016-11-10 Thread Guido van Rossum

Changes by Guido van Rossum :


--
title: Document recen changes in typing.py -> Document recent changes in 
typing.py

___
Python tracker 

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



[issue28635] Update What's New for 3.6

2016-11-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4c81a107ccab by Yury Selivanov in branch '3.6':
Issue #28635: what's new in 3.6: remove mentions of backported fixes.
https://hg.python.org/cpython/rev/4c81a107ccab

New changeset 8ebaa546a033 by Yury Selivanov in branch 'default':
Merge 3.6 (issue #28635)
https://hg.python.org/cpython/rev/8ebaa546a033

--

___
Python tracker 

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



[issue28635] Update What's New for 3.6

2016-11-10 Thread Elvis Pranskevichus

Elvis Pranskevichus added the comment:

Thanks Serhiy.  I removed mentions of things that were indeed fixes backported 
to 3.5.  Other issue references are valid news, including new features to 
provisional modules backported to 3.5.  It is customary to include these in the 
news for the major release.

--
Added file: 
http://bugs.python.org/file45430/0001-Issue-28635-what-s-new-in-3.6-remove-mentions-of-bac.patch

___
Python tracker 

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



Re: I want to insert beacon scan result in to a database using python and mysql

2016-11-10 Thread Michael Torrie
On 11/10/2016 11:32 AM, Chris Angelico wrote:
> The easiest way is to use a parameterized query:
> 
> cur.execute("insert into beacon VALUES(null, %s)", (beacon,))
> 
> I don't understand why so many people conflate parameterized with
> prepared. "Prepared statements" have a two-step execution.
> "Parameterized queries" needn't.

Good point. Yes that's what I was going for but forgot the term.

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


[issue28635] Update What's New for 3.6

2016-11-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

+The disassembler now decodes ``FORMAT_VALUE`` argument.
+(Contributed by Serhiy Storchaka in :issue:`28317`.)

FORMAT_VALUE is new in 3.6. This change should be considered as a part of PEP 
498 and is not deserve special mentioning.

--

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-11-10 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
assignee:  -> orsenthil

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-11-10 Thread Sohaib Ahmad

Sohaib Ahmad added the comment:

@Senthil, thanks for looking into this.

Looking forward to your commit.

Regards.

--

___
Python tracker 

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



[issue28661] Fix code example in Python 3.5 telnetlib documentation

2016-11-10 Thread Ivan Tomilov

New submission from Ivan Tomilov:

The code sample on page https://docs.python.org/3/library/telnetlib.html is a 
little confusing. The extra space in string "Password: " before the second 
quote basically hangs the example program when you try to run it.

Please, check my answer on Stack Overflow for more details:
http://stackoverflow.com/questions/28345839/python3-telnet-code-stays-quiet-after-launching-does-not-initiate-the-command-t/40535049#40535049

I'm sorry if I get something wrong.

Thanks,
Ivan.

--
assignee: docs@python
components: Documentation
messages: 280536
nosy: docs@python, tiabc
priority: normal
severity: normal
status: open
title: Fix code example in Python 3.5 telnetlib documentation
type: enhancement
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



[issue28635] Update What's New for 3.6

2016-11-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Patches for following issues was applied in 3.5. They may be bug fixes, not new 
features.

#13248 #16113 #20476 #22115 #23517 #24764 #25590 #25593 #25913 #26470 #26733 
#26754 #26801 #27040 #27041 #27243 #27392 #27598 #27691 #27766 #27850 #27932 
#28370 #28613

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue21145] Add the @cached_property decorator

2016-11-10 Thread Carl Meyer

Carl Meyer added the comment:

I've used the cached_property pattern across many different projects, and never 
yet wanted a TTL. The simple "cache for the lifetime of the instance" behavior 
is easy to implement, easy to understand, and useful for a wide range of 
scenarios where instances are effectively immutable. +1 for adding this to the 
stdlib (not just as a docs recipe); I'll see about providing a patch.

--
nosy: +carljm

___
Python tracker 

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



[issue557704] netrc module can't handle all passwords

2016-11-10 Thread Cristian Măgherușan-Stanciu

Cristian Măgherușan-Stanciu added the comment:

Is there anything blocking this from being really fixed? It's still broken on 
3.5.

The patch added two years ago works well for quoted passwords, I think that's 
good enough, anyway having some support is much better than the current out of 
the box situation.

--
versions: +Python 3.5 -Python 2.2

___
Python tracker 

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



Re: I want to insert beacon scan result in to a database using python and mysql

2016-11-10 Thread Chris Angelico
On Fri, Nov 11, 2016 at 2:36 AM, Michael Torrie  wrote:
> On 11/10/2016 06:15 AM, Dennis Lee Bieber wrote:
>> On Wed, 9 Nov 2016 21:05:50 -0800 (PST), sudeeratechn...@gmail.com
>> declaimed the following:
>>
>>>
>>> sql = "insert into beacon VALUES(null, '%s')" % \
>>> (beacon)
>>>
>>   DON'T DO THAT...
>
> Wouldn't hurt to include a brief why on this, and the right way to do
> this.  The why is, of course, that this operation is vulnerable to SQL
> injection. This should be avoided as a matter of practice, even if
> you're not taking input from anyone but yourself.  The correct way to do
> this is to use a prepared statement.  And of course the relevant xkcd
> is:  https://xkcd.com/327/

The easiest way is to use a parameterized query:

cur.execute("insert into beacon VALUES(null, %s)", (beacon,))

I don't understand why so many people conflate parameterized with
prepared. "Prepared statements" have a two-step execution.
"Parameterized queries" needn't.

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


[issue28635] Update What's New for 3.6

2016-11-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c0060567f35d by Yury Selivanov in branch '3.6':
Issue #28635: What's New in Python 3.6 updates
https://hg.python.org/cpython/rev/c0060567f35d

New changeset 69bdf8bdfd61 by Yury Selivanov in branch 'default':
Merge 3.6 (issue #28635)
https://hg.python.org/cpython/rev/69bdf8bdfd61

--

___
Python tracker 

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



[issue28635] Update What's New for 3.6

2016-11-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bcd4ab982429 by Yury Selivanov in branch '3.6':
Issue #28635: Fix a couple of missing/incorrect versionchanged tags
https://hg.python.org/cpython/rev/bcd4ab982429

New changeset 5c4ce500dd35 by Yury Selivanov in branch 'default':
Merge 3.6 (issue #28635)
https://hg.python.org/cpython/rev/5c4ce500dd35

--

___
Python tracker 

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



[issue28641] Describe PEP 495 features in "What's New in Python 3.6" document

2016-11-10 Thread Yury Selivanov

Yury Selivanov added the comment:

Closing this one.

--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

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



[issue28635] Update What's New for 3.6

2016-11-10 Thread Elvis Pranskevichus

Elvis Pranskevichus added the comment:

Attached patch for another pass on what's new.

--

___
Python tracker 

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



[issue28635] Update What's New for 3.6

2016-11-10 Thread Elvis Pranskevichus

Changes by Elvis Pranskevichus :


Added file: 
http://bugs.python.org/file45428/0001-Issue-28635-Fix-a-couple-of-missing-incorrect-versio.patch

___
Python tracker 

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



[issue28641] Describe PEP 495 features in "What's New in Python 3.6" document

2016-11-10 Thread Elvis Pranskevichus

Elvis Pranskevichus added the comment:

This should now be covered in #28635.

--

___
Python tracker 

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



[issue28635] Update What's New for 3.6

2016-11-10 Thread Elvis Pranskevichus

Changes by Elvis Pranskevichus :


Added file: 
http://bugs.python.org/file45429/0002-Issue-28635-What-s-New-in-Python-3.6-updates.patch

___
Python tracker 

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



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2016-11-10 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

On, I got complex type in cloudABI. I see my patch doesn't solve it.

https://github.com/NuxiNL/cloudlibc/blob/master/src/include/sys/types.h#L94
https://github.com/NuxiNL/cloudlibc/blob/master/src/include/_/types.h#L209

--

___
Python tracker 

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



[issue28660] TextWrapper break_long_words=True, break_on_hyphens=True on long words

2016-11-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Library (Lib)
nosy: +georg.brandl, serhiy.storchaka
type:  -> behavior
versions: +Python 3.5, 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



[issue28656] build error in cygwin64 ,because pthread_key_t

2016-11-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> PyThread assumes pthread_key_t is an integer, which is against 
POSIX

___
Python tracker 

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



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2016-11-10 Thread Ed Schouten

Ed Schouten added the comment:

CloudABI uses a structure type, which is exactly why I filed this bug report.

Instead of speculating about what kind of type existing implementations use, 
please just focus on the specification to which we're trying to stick: POSIX.

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html

"All of the types shall be defined as arithmetic types of an appropriate 
length, with the following exceptions:

[...]
pthread_key_t
[...]"

--

___
Python tracker 

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



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2016-11-10 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

Umm, API seems a design that is passing into function by integer or pointer 
because the users don't need type detail. I think the implementation of complex 
type is not realistic. Actually, CouldABI and Cygwin are used pointer, and type 
detail is hided.

--

___
Python tracker 

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



[issue28649] refleak in typing.py

2016-11-10 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

I think tearDown() is not necessary. But on the other hand it could be nice to 
have a method in tests to force cache clear. I would propose it not as a 
default, but as an opt-in to check that cache works well, or that a certain 
tested feature is "cache independent", etc.

--

___
Python tracker 

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



Re: Python rules!

2016-11-10 Thread Skip Montanaro
Alister> i think whoever did that WAS a tool

Perhaps, but maybe she is a Python programmer forced to write Java
(not Jython). If so, props to her for making the best of a bad
situation. :-)

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


[issue28649] refleak in typing.py

2016-11-10 Thread Guido van Rossum

Guido van Rossum added the comment:

BTW, do we still want the tearDown()? Or is that no longer necessary?

--

___
Python tracker 

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



[issue28660] TextWrapper break_long_words=True, break_on_hyphens=True on long words

2016-11-10 Thread Peter

New submission from Peter:

Quoting https://docs.python.org/2/library/textwrap.html

width (default: 70) The maximum length of wrapped lines. As long as there are 
no individual words in the input text longer than width, TextWrapper guarantees 
that no output line will be longer than width characters.

It appears that with break_long_words=True and break_on_hyphens=True, any 
hyphenated term longer than the specified width does not get preferentially 
broken at a hyphen.

Example input:

We used the enyzme 2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate 
synthase.


Using break_long_words=True, break_on_hyphens=True
==
We used the enyzme 2-succinyl-6-hydroxy-2,4-cycloh
exadiene-1-carboxylate synthase.
==


Expected result using break_long_words=True, break_on_hyphens=True
==
We used the enyzme 2-succinyl-6-hydroxy-2,4-
cyclohexadiene-1-carboxylate synthase.
==


Given a width=50, then the 53 character long "word" of 
"2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate" must be split 
somewhere, and since break_on_hyphens=True it should break at a hyphen as shown 
above as the desired output.


Sample code:


import textwrap
w = 50
text = "We used the enyzme 
2-succinyl-6-hydroxy-2,4-cyclohexadiene-1-carboxylate synthase."
print("Input:")
print("=" * w)
print(text)
print("=" * w)
print("Using break_long_words=True, break_on_hyphens=True")
print("=" * w)
print(textwrap.fill(text, width=w, break_long_words=True, 
break_on_hyphens=True))
print("=" * w)

--
messages: 280522
nosy: maubp
priority: normal
severity: normal
status: open
title: TextWrapper break_long_words=True, break_on_hyphens=True on long words
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



[issue28649] refleak in typing.py

2016-11-10 Thread Yury Selivanov

Yury Selivanov added the comment:

Thank you Guido and Ivan!

> Yury, when you're happy with the situation can you close this issue?

I'll close it now, will reopen if something comes up.

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

___
Python tracker 

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



[issue28649] refleak in typing.py

2016-11-10 Thread Guido van Rossum

Guido van Rossum added the comment:

Thanks a bundle, Ivan! I've merged those two into CPython 3.5, 3.6, 3.7. We can 
now watch the build bots for a while and double-check the refleaks.

Yury, when you're happy with the situation can you close this issue?

--

___
Python tracker 

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



[issue28649] refleak in typing.py

2016-11-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 555f0ca31587 by Guido van Rossum in branch '3.5':
Issue #28649: fix second issue with _ForwardRef (#328)
https://hg.python.org/cpython/rev/555f0ca31587

New changeset 0f863906cf2e by Guido van Rossum in branch '3.6':
Issue #28649: fix second issue with _ForwardRef (#328) (3.5->3.6)
https://hg.python.org/cpython/rev/0f863906cf2e

New changeset 84b4ac243508 by Guido van Rossum in branch 'default':
Issue #28649: fix second issue with _ForwardRef (#328) (3.6->3.7)
https://hg.python.org/cpython/rev/84b4ac243508

--

___
Python tracker 

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



[issue28649] refleak in typing.py

2016-11-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0da2e381ad71 by Guido van Rossum in branch '3.5':
Issue #28649: fix first issue with _ForwardRef (#327)
https://hg.python.org/cpython/rev/0da2e381ad71

New changeset 249a1f0b2857 by Guido van Rossum in branch '3.6':
Issue #28649: fix first issue with _ForwardRef (#327) (3.5->3.6)
https://hg.python.org/cpython/rev/249a1f0b2857

New changeset 304f017462e4 by Guido van Rossum in branch 'default':
Issue #28649: fix first issue with _ForwardRef (#327) (3.6->3.7)
https://hg.python.org/cpython/rev/304f017462e4

--

___
Python tracker 

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



[issue28659] xml.etree.cElementTree.write misses opening tag

2016-11-10 Thread Xiang Zhang

Xiang Zhang added the comment:

 is an empty tag. It closes it self, not '/>'.

With some content, you can see it has start and end tag.

>>> import xml.etree.cElementTree as ET
>>> events = ET.Element('Events')
>>> events.text = 'abc'
>>> tree = ET.ElementTree(events)
>>> tree.write('/tmp/a.xml', xml_declaration=True, encoding='UTF-8')


abc

--
nosy: +xiang.zhang
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue28659] xml.etree.cElementTree.write misses opening tag

2016-11-10 Thread Xiang Zhang

Xiang Zhang added the comment:

s/not/note

--

___
Python tracker 

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



[issue28659] xml.etree.cElementTree.write misses opening tag

2016-11-10 Thread Stelios

New submission from Stelios:

import xml.etree.cElementTree as ET

events = ET.Element('Events')
tree = ET.ElementTree(events)
tree.write('test.xml', xml_declaration=True, encoding='UTF-8')

writes to file:



Where opening tag  is missing

Python version: Python 3.5.2

--
components: XML
messages: 280515
nosy: chefarov
priority: normal
severity: normal
status: open
title: xml.etree.cElementTree.write misses opening tag
type: behavior
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



[issue28649] refleak in typing.py

2016-11-10 Thread Guido van Rossum

Guido van Rossum added the comment:

We discussed cache size previously and 128 is fine.

--Guido (mobile)

--

___
Python tracker 

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



[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2016-11-10 Thread Ed Schouten

Ed Schouten added the comment:

It can also be a structure or a union.

--

___
Python tracker 

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



[issue28649] refleak in typing.py

2016-11-10 Thread Yury Selivanov

Yury Selivanov added the comment:

Good work, Ivan!

> Those two seem to fix everything, I tried various cache sizes with both C and 
> Python versions of lru_cache and found no refleaks.

Speaking of lru_cache: typing currently doesn't configure maxsize, which means 
that the cache is limited to 128 items.  Is that OK?  Should maxsize be set to 
None to make the cache unlimited, or, maybe, a higher number like 1024 is more 
appropriate?

--

___
Python tracker 

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



Re: N-grams

2016-11-10 Thread srinivas devaki
On Thu, Nov 10, 2016 at 2:26 PM, Peter Otten <__pete...@web.de> wrote:
>
> I don't think I've seen tee(iterable, 1) before. Did you do this for
> aesthetic reasons or is there an advantage over
>
>   t = [iter(iterable)]

Yeah just to be aesthetic, there's no extra advantage over that as
with n=1 tee just returns a wrapper around the iterable.


Regards
Srinivas Devaki
Senior (4th year) student at Indian Institute of Technology (ISM), Dhanbad
Computer Science and Engineering Department
phone: +91 9491 383 249
telegram: @eightnoteight
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: I want to insert beacon scan result in to a database using python and mysql

2016-11-10 Thread Michael Torrie
On 11/10/2016 06:15 AM, Dennis Lee Bieber wrote:
> On Wed, 9 Nov 2016 21:05:50 -0800 (PST), sudeeratechn...@gmail.com
> declaimed the following:
> 
>>
>> sql = "insert into beacon VALUES(null, '%s')" % \
>> (beacon)
>>
>   DON'T DO THAT...

Wouldn't hurt to include a brief why on this, and the right way to do
this.  The why is, of course, that this operation is vulnerable to SQL
injection. This should be avoided as a matter of practice, even if
you're not taking input from anyone but yourself.  The correct way to do
this is to use a prepared statement.  And of course the relevant xkcd
is:  https://xkcd.com/327/


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


[issue25658] PyThread assumes pthread_key_t is an integer, which is against POSIX

2016-11-10 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

Hi, I came from #28656.
I have read past discussions, And I've understood the pthread_key_t has 
possible of either integer or pointer.  So I think there is a simple solution 
that replaces key type to intptr_t.
Thus I wrote a patch, but it maybe need configure check for intptr_t if 
CPytyhon still be supporting for before C99 compilers.
I confirmed patch on Cygwin x86. Would you be able to confirm for other 
platforms?

--
nosy: +masamoto
type:  -> compile error
versions: +Python 3.7
Added file: http://bugs.python.org/file45427/pythread-key-intptr_t.patch

___
Python tracker 

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



Re: Why I took October off from OSS volunteering

2016-11-10 Thread Ethan Furman

On 11/09/2016 11:35 PM, breamore...@gmail.com wrote:


http://www.snarky.ca/why-i-took-october-off-from-oss-volunteering


Good article, Mark, thanks for sharing.

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


[issue24329] __qualname__ and __slots__

2016-11-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

__qualname__ doesn't makes much sense if it doesn't match __module__. If 
_GeneratorWrapper patches __qualname__, I think it should patch __module__ too.

--

___
Python tracker 

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



Why I took October off from OSS volunteering

2016-11-10 Thread breamoreboy
http://www.snarky.ca/why-i-took-october-off-from-oss-volunteering
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue28658] MacOsX idle don't run

2016-11-10 Thread Andrew Kontokanis

New submission from Andrew Kontokanis:

When I try and launch IDLE, the icon appears on the dock for a second and then 
disappears and the application doesn't run.
I was trying to install new themes but when I managed to do find .idlerc folder 
I had messed up with some idle folder. I tried to uninstall and install but it 
didn't work.
Trying to find solution I read some hints to check through terminal and I took 
these messages in attachment. I didn't find the same solution with the previous 
problems so I opened an question

--
files: error.log.pdf
messages: 280509
nosy: Andrew Kontokanis
priority: normal
severity: normal
status: open
title: MacOsX idle don't run
type: crash
versions: Python 3.5
Added file: http://bugs.python.org/file45426/error.log.pdf

___
Python tracker 

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



[issue24329] __qualname__ and __slots__

2016-11-10 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy:  -pitrou

___
Python tracker 

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



[issue28654] sys.stdout.isatty() returns True even if redirected to NUL

2016-11-10 Thread Марк Коренберг

Марк Коренберг added the comment:

1. I think, that is not a bug.
2. It seems, that for Cygwin, `> /dev/nul` is a bug, it should be `/dev/null` 
does not it ?

--
nosy: +mmarkk

___
Python tracker 

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



[issue24329] __qualname__ and __slots__

2016-11-10 Thread Xiang Zhang

Xiang Zhang added the comment:

slots_special_v2 fixes a bug in the previous patch.

--
Added file: http://bugs.python.org/file45425/slots_special_v2.patch

___
Python tracker 

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



[issue28644] Document recen changes in typing.py

2016-11-10 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Guido, here is a new patch with your comments implemented.

--
Added file: http://bugs.python.org/file45424/recent-typing-docs-v4.diff

___
Python tracker 

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



Re: Help me cythonize a python routine!

2016-11-10 Thread BartC

On 09/11/2016 21:25, breamore...@gmail.com wrote:

On Wednesday, November 9, 2016 at 7:34:41 PM UTC, BartC wrote:



However according to your mindset nothing matters provided it's fast,

> accuracy does not matter to users.


Hence your recent comment on another thread about converting invalid integer 
entries into zero.


That's by design. And it's not unprecedented; using C's 'atoi()' 
function (convert a string to an integer), then inputs of "" and "ABC" 
both return 0. Input of "123ABC" returns 123.


And in the context that was being discussed, it was desired that hitting 
end-of-line while attempting to read more items should return null 
values such as 0, 0.0 or "".


For any more refined behaviour, values can be read differently (read as 
strings then converted with routines that do more validation).


Effectively, the conversion looks at the entire line buffer contents 
remaining, and converts the first integer encountered, if any, then 
removes that and any terminator from the buffer.


If I try something like that in Python, trying to convert an integer at 
the beginning of a string, it fails: int("123,456"), int("123 456"),
int("63924 the"). It will need processing first so that the parameter 
comprises only the thing we're trying to read.


Anyway the comparison between Python and that particular /lower-level/ 
language is moot as Python apparently doesn't have a way of directly 
reading items from an input line, either from a console or from a file.


You have to read a line as one string then apply DIY conversions. Which 
the other language could equally do.


So it's a detail. The other language could also have chosen to use 
exceptions to signal such events (no integer following, end of input, 
invalid terminator etc). I chose to keep it simple and to make it work 
the same way it's always done.


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


[issue24329] __qualname__ and __slots__

2016-11-10 Thread Xiang Zhang

Xiang Zhang added the comment:

> What about other names set when creating a class? __module__, __class__, 
> __classcell__?

__module__ remains in the class dict so I think it's a class variable.
Will __class__ be set? It's inserted into the function scope.
__classcell__ I think has the same situation with __qualname__.

New patch also adds __classcell__.

--
Added file: http://bugs.python.org/file45423/slots_special.patch

___
Python tracker 

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



[issue28654] sys.stdout.isatty() returns True even if redirected to NUL

2016-11-10 Thread Kuno Meyer

Kuno Meyer added the comment:

http://stackoverflow.com/questions/3648711/detect-nul-file-descriptor-isatty-is-bogus,
 although a bit convoluted, might also help. It mentions GetConsoleMode() for 
stdin and GetConsoleScreenBufferInfo() for stdout.

--

___
Python tracker 

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



[issue28656] build error in cygwin64 ,because pthread_key_t

2016-11-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue25658.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28657] cmd.Cmd.get_help() implementation can't see do_*() methods added dynamically by setattr()

2016-11-10 Thread Błażej Michalik

New submission from Błażej Michalik:

The issue here seems to originate from the implementation of Cmd.get_names():

def get_names(self):   
# This method used to pull in base class attributes
# at a time dir() didn't do it yet.
return dir(self.__class__) 

Changing it to dir(self) would make dynamical adding helpstrings for commands 
possible.

--
components: Library (Lib)
messages: 280502
nosy: Błażej Michalik
priority: normal
severity: normal
status: open
title: cmd.Cmd.get_help() implementation can't see do_*() methods added 
dynamically by setattr()
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, 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



[issue28649] refleak in typing.py

2016-11-10 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

OK, here are the PRs:

https://github.com/python/typing/pull/327
https://github.com/python/typing/pull/328

Those two seem to fix everything, I tried various cache sizes with both C and 
Python versions of lru_cache and found no refleaks.

--

___
Python tracker 

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



[issue19398] test_trace fails with -S

2016-11-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The separator is needed if the relative path is not empty and the prefix 
doesn't end with the separator.

This patch seems also fixes most problems of issue28655.

--
assignee:  -> serhiy.storchaka
nosy: +serhiy.storchaka
versions: +Python 3.5, Python 3.6, Python 3.7 -Python 3.4
Added file: 
http://bugs.python.org/file45422/remove_extra_slash_from_sys_path_v3.patch

___
Python tracker 

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



Re: Python rules!

2016-11-10 Thread alister
On Wed, 09 Nov 2016 20:45:45 -0600, Skip Montanaro wrote:

> On Wed, Nov 9, 2016 at 7:53 PM, Chris Angelico  wrote:
>> It's called Jython. :)
> 
> Well, sure, but that didn't look enough like Python, so no chance that I
> would mistake it for Jython. I suspect that whoever worked out that
> arrangement of semicolons and braces had some help from her tools.
> 
> Skip

i think whoever did that WAS a tool



-- 
How long does it take a DEC field service engineer to change a lightbulb?

It depends on how many bad ones he brought with him.
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >