[issue32441] os.dup2 should return the new fd

2017-12-28 Thread Benjamin Peterson

Change by Benjamin Peterson :


--
keywords: +patch
pull_requests: +4924
stage: needs patch -> patch review

___
Python tracker 

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



[issue32442] Result of pathlib.Path.resolve() with UNC path is not very useful

2017-12-28 Thread Tzu-ping Chung

Tzu-ping Chung  added the comment:

@Eric

You’re correct, this is not the exact output. I tested the commands with a 
different path, but didn’t format them correctly when I convert them to use a 
generic example. Sorry for the confusion.


@Eryk

I found my problem. I was doing some os.rename and shutil stuff that constantly 
fails when moving and copying things using UNC paths, but works flawlessly when 
I convert them to use drives. I assumed it’s because the UNC, but after a more 
involved debugging I find all UNC calls work by themselves, only fail when I 
combine them. I guess it is due to some strange Windows thing, maybe UNC file 
stat can’t update fast enough for the next call to get the correct state or 
something.

The attached recipe worked very well. Thanks for the help!

I’m closing this since the problem is likely not Python-related. Sorry for the 
disturbance.

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



[issue23749] asyncio missing wrap_socket (starttls)

2017-12-28 Thread Yury Selivanov

Change by Yury Selivanov :


--
pull_requests: +4923
stage: needs patch -> patch review

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-28 Thread Neil Schemenauer

Neil Schemenauer  added the comment:

I wonder if I should drop PR 4682.  I spent some more time working on it today. 
 I switched to the same scheme as Serhiy for the no-exception case, i.e. push a 
single NULL value, rather than six NULLs.  In ceval, we need to handle the 
non-exception case specially anyhow so I think it better to avoid the "stack 
churn".  With the micro-benchmarks that Serhiy posted, PR 4682 is as fast or 
slightly faster than PR 5006.  Doesn't really matter in real code though.

I did not push my latest changes as I did not fix the frame.f_lineno issue yet. 
 I think it is fixable without major changes.  Should I bother though?  Is 
there some other reason to prefer duplicating the final bodies rather than 
using a subroutine jump (as in 5006)?  A very minor speedup is not worth it I 
think because the compiler is a bit more complicated.  The settrace logic is 
more complicated too.

--

___
Python tracker 

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



Re: Goto

2017-12-28 Thread breamoreboy
On Friday, December 29, 2017 at 3:28:23 AM UTC, Ben Finney wrote:
> Tim Chase writes:
> 
> > [third-party website]
> > Gives you […]
> 
> So, it's not in Python, it's a third-party (joke) package. Hence is
> probably not what Duram is asking about as “goto in Python”.
> 
> I'm still open to learning what Duram meant by “goto in Python”. Rather
> than everyone else piling on with suggestions, can we let Duram answer?
> 
> -- 
>  \  “Think for yourselves and let others enjoy the privilege to do |
>   `\  so too.” —Voltaire, _Essay On Tolerance_ |
> _o__)  |
> Ben Finney

Did you miss Tim's wink, which you've cut from your reply, or did you get out 
of bed on the wrong side this morning, or what?

--
Kindest regards.

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


[issue32442] Result of pathlib.Path.resolve() with UNC path is not very useful

2017-12-28 Thread Eryk Sun

Eryk Sun  added the comment:

> the UNC path is not really useful anywhere in the Python 
> standard library 

UNC paths can be used almost anywhere in the file API. What specifically isn't 
working?

> there’s no way to turn the it (back) into network drive once you 
> call resolve()

Without using ctypes or PyWin32, you could resolve the root directory on drives 
A-Z to find the shortest matching path. This would also work with SUBST drives. 
For example:

def resolve_mapped(path):
path = pathlib.Path(path).resolve()
mapped_paths = []
for drive in 'ZYXWVUTSRQPONMLKJIHGFEDCBA':
root = pathlib.Path('{}:/'.format(drive))
try:
mapped_paths.append(root / path.relative_to(root.resolve()))
except (ValueError, OSError):
pass
return min(mapped_paths, key=lambda x: len(str(x)), default=path)

--
nosy: +eryksun
type:  -> enhancement

___
Python tracker 

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



Re: Goto

2017-12-28 Thread Ben Finney
Tim Chase  writes:

> [third-party website]
> Gives you […]

So, it's not in Python, it's a third-party (joke) package. Hence is
probably not what Duram is asking about as “goto in Python”.

I'm still open to learning what Duram meant by “goto in Python”. Rather
than everyone else piling on with suggestions, can we let Duram answer?

-- 
 \  “Think for yourselves and let others enjoy the privilege to do |
  `\  so too.” —Voltaire, _Essay On Tolerance_ |
_o__)  |
Ben Finney

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


Re: Goto

2017-12-28 Thread Tim Chase
On 2017-12-29 08:42, Ben Finney wrote:
> Duram  writes:
> 
> > How to use goto in python?  
> 
> Step 0: what is goto in Python?
> 
> Step 1: that's not something that exists in Python. So why are you
> asking how to use something that doesn't exist?

so quick to shoot down a poor soul.

http://entrian.com/goto/

Gives you both GOTO and COMEFROM ;-)

-tkc




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


[issue32420] LookupError : unknown encoding : [0x7FF092395AD0] ANOMALY

2017-12-28 Thread Kaoru Kitamura

Kaoru Kitamura  added the comment:

Understood. Thank you.

--
resolution: remind -> 

___
Python tracker 

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



Re: Goto

2017-12-28 Thread breamoreboy
On Thursday, December 28, 2017 at 7:40:14 PM UTC, alister wrote:
> On Thu, 28 Dec 2017 00:58:48 -0200, Duram wrote:
> 
> > How to use goto in python?
> > 
> > ---
> > This email has been checked for viruses by AVG.
> > http://www.avg.com
> 
> Dont!
> actually you cant - there isn't one*
> 
> *at least not in the core language no doubt some sick person will have 
> manager to hack together some sort of dodgy code to simulate it if you 
> look hard enough)
> 

This http://entrian.com/goto/ has been around for almost 14 years.

--
Kindest regards.

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


[issue32444] python -m venv has incongruous behavor creating binaries

2017-12-28 Thread Corey Seliger

Corey Seliger  added the comment:

Here is the write-up I posted over on the pyenv issues page:

This is apparently a behavior issue in the way venv works. Not only does this 
impact 3.6.x, I also confirmed that the same issue occurs with venv in general 
using the stock 3.5 Python that comes with Ubuntu 16.04.

The trouble is at 3.6/Lib/venv/__init__.py:111. Starting at line 111:

if sys.platform == 'darwin' and '__PYVENV_LAUNCHER__' in env:
executable = os.environ['__PYVENV_LAUNCHER__']
else:
executable = sys.executable
dirname, exename = os.path.split(os.path.abspath(executable))
context.executable = executable

This carries down to the setup_python method starting at line 187 
(3.6/Lib/venv/__init__.py:187). It takes whatever executable that is called as 
the source, and then creates the others based on a hard coded list (e.g. python 
and python3).

def setup_python(self, context):
"""
Set up a Python executable in the environment.
:param context: The information for the environment creation request
being processed.
"""
binpath = context.bin_path
path = context.env_exe
copier = self.symlink_or_copy
copier(context.executable, path)
dirname = context.python_dir
if os.name != 'nt':
if not os.path.islink(path):
os.chmod(path, 0o755)
for suffix in ('python', 'python3'):
path = os.path.join(binpath, suffix)
if not os.path.exists(path):
# Issue 18807: make copies if
# symlinks are not wanted
copier(context.env_exe, path, relative_symlinks_ok=True)
if not os.path.islink(path):
os.chmod(path, 0o755)
else:
subdir = 'DLLs'
include = self.include_binary
files = [f for f in os.listdir(dirname) if include(f)]
for f in files:
src = os.path.join(dirname, f)
dst = os.path.join(binpath, f)
if dst != context.env_exe:  # already done, above
copier(src, dst)
dirname = os.path.join(dirname, subdir)
if os.path.isdir(dirname):
files = [f for f in os.listdir(dirname) if include(f)]
for f in files:
src = os.path.join(dirname, f)
dst = os.path.join(binpath, f)
copier(src, dst)
# copy init.tcl over
for root, dirs, files in os.walk(context.python_dir):
if 'init.tcl' in files:
tcldir = os.path.basename(root)
tcldir = os.path.join(context.env_dir, 'Lib', tcldir)
if not os.path.exists(tcldir):
os.makedirs(tcldir)
src = os.path.join(root, 'init.tcl')
dst = os.path.join(tcldir, 'init.tcl')
shutil.copyfile(src, dst)
break


If you don't call -m venv as python3.X, you will never get that binary in the 
bin directory.

--

___
Python tracker 

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



[issue32444] python -m venv has incongruous behavor creating binaries

2017-12-28 Thread Corey Seliger

New submission from Corey Seliger :

The venv module does not evenly create the necessary binaries/symlinks when 
building virtualenvs. If you call venv like this:

seliger@core:~/venvs$ python3 -m venv venvA

seliger@core:~/venvs$ ls -l venvA/bin/
total 32
-rw-r--r-- 1 seliger seliger 2143 Dec 28 21:29 activate
-rw-r--r-- 1 seliger seliger 1259 Dec 28 21:29 activate.csh
-rw-r--r-- 1 seliger seliger 2397 Dec 28 21:29 activate.fish
-rwxrwxr-x 1 seliger seliger  254 Dec 28 21:29 easy_install
-rwxrwxr-x 1 seliger seliger  254 Dec 28 21:29 easy_install-3.5
-rwxrwxr-x 1 seliger seliger  226 Dec 28 21:29 pip
-rwxrwxr-x 1 seliger seliger  226 Dec 28 21:29 pip3
-rwxrwxr-x 1 seliger seliger  226 Dec 28 21:29 pip3.5
lrwxrwxrwx 1 seliger seliger7 Dec 28 21:29 python -> python3
lrwxrwxrwx 1 seliger seliger   16 Dec 28 21:29 python3 -> /usr/bin/python3

...you do not end up with a "python3.5" binary. 

However, if you call venv like this:

seliger@core:~/venvs$ python3.5 -m venv venvB

seliger@core:~/venvs$ ls -l venvB/bin
total 32
-rw-r--r-- 1 seliger seliger 2143 Dec 28 21:29 activate
-rw-r--r-- 1 seliger seliger 1259 Dec 28 21:29 activate.csh
-rw-r--r-- 1 seliger seliger 2397 Dec 28 21:29 activate.fish
-rwxrwxr-x 1 seliger seliger  256 Dec 28 21:29 easy_install
-rwxrwxr-x 1 seliger seliger  256 Dec 28 21:29 easy_install-3.5
-rwxrwxr-x 1 seliger seliger  228 Dec 28 21:29 pip
-rwxrwxr-x 1 seliger seliger  228 Dec 28 21:29 pip3
-rwxrwxr-x 1 seliger seliger  228 Dec 28 21:29 pip3.5
lrwxrwxrwx 1 seliger seliger9 Dec 28 21:29 python -> python3.5
lrwxrwxrwx 1 seliger seliger9 Dec 28 21:29 python3 -> python3.5
lrwxrwxrwx 1 seliger seliger   18 Dec 28 21:29 python3.5 -> /usr/bin/python3.5

...you DO get the necessary python3.5 binary. Some vendors are making it a 
requirement to call a specific pythonX.Y binary to ensure compatibility. One 
such example is the serverless framework when deploying to Amazon Web Services. 
Another example is the useful pyenv utility that manages full Python builds and 
virtualenvs. When it depends upon venv, it exhibits the same behavior. I 
submitted a patch workaround to force calling venv using pythonX.Y, but this 
really seems like an issue with the venv module itself.

The expected behavior should be that venv generates all three binaries (python, 
python3, and python3.5) regardless of how the python command was invoked.

I am able to reproduce this on Python 3.5 and 3.6. I could not find any other 
similar references in searching the bug system.

--
components: Library (Lib)
messages: 309157
nosy: seliger
priority: normal
severity: normal
status: open
title: python -m venv has incongruous behavor creating binaries
type: behavior
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue32420] LookupError : unknown encoding : [0x7FF092395AD0] ANOMALY

2017-12-28 Thread R. David Murray

R. David Murray  added the comment:

Well, it's not obvious that it has anything to do with CPython itself.  You 
should probably work with the community responsible for tensorflow, whatever 
that is, and if they find a bug in CPython you can come back here with a 
report.  Given the error message it looks like an invalid value is being passed 
to CPython as the system encoding, so most likely the bug is in tensorflow 
and/or your environment.

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



[issue24960] Can't use lib2to3 with embeddable zip file.

2017-12-28 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset 85f71aa9d6f834c7d64e979009c8fda0f19b585d by Benjamin Peterson 
(Miss Islington (bot)) in branch '3.6':
make PatternCompiler use the packaged grammar if possible (more bpo-24960) 
(GH-5034) (#5036)
https://github.com/python/cpython/commit/85f71aa9d6f834c7d64e979009c8fda0f19b585d


--

___
Python tracker 

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



[issue24960] Can't use lib2to3 with embeddable zip file.

2017-12-28 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset 417f76a20e93044e422fb328a2d8e200fc6df295 by Benjamin Peterson 
(Miss Islington (bot)) in branch '2.7':
make PatternCompiler use the packaged grammar if possible (more bpo-24960) 
(GH-5034) (#5037)
https://github.com/python/cpython/commit/417f76a20e93044e422fb328a2d8e200fc6df295


--

___
Python tracker 

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



[issue24960] Can't use lib2to3 with embeddable zip file.

2017-12-28 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4922

___
Python tracker 

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



[issue24960] Can't use lib2to3 with embeddable zip file.

2017-12-28 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4921

___
Python tracker 

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



[issue24960] Can't use lib2to3 with embeddable zip file.

2017-12-28 Thread Benjamin Peterson

Benjamin Peterson  added the comment:


New changeset e5f7dccefaa8d97ab53b3051acbb4a4d49379dc4 by Benjamin Peterson in 
branch 'master':
make PatternCompiler use the packaged grammar if possible (more bpo-24960) 
(#5034)
https://github.com/python/cpython/commit/e5f7dccefaa8d97ab53b3051acbb4a4d49379dc4


--

___
Python tracker 

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



[issue32443] Add Linux's signalfd() to the signal module

2017-12-28 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

An example subprocess improvement using sigtimedwait() - 
https://github.com/python/cpython/pull/5035 - led me to believe that signalfd() 
is superior as it sounds like signalfd() does not require pthread_sigmask 
(sigprocmask) global state manipulation calls.  I have not confirmed if that is 
true.

--

___
Python tracker 

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



[issue24960] Can't use lib2to3 with embeddable zip file.

2017-12-28 Thread Benjamin Peterson

Change by Benjamin Peterson :


--
pull_requests: +4920

___
Python tracker 

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



Re: Goto

2017-12-28 Thread Chris Angelico
On Fri, Dec 29, 2017 at 11:17 AM, bartc  wrote:
> On 28/12/2017 21:42, Ben Finney wrote:
>>
>> Duram  writes:
>>
>>> How to use goto in python?
>>
>>
>> Step 0: what is goto in Python?
>>
>> Step 1: that's not something that exists in Python. So why are you
>> asking how to use something that doesn't exist?
>
>
> Goto exists in the form of the JUMP_ABSOLUTE byte-code.
>
> But it's not accessible from the language.
>

That's an implementation detail in one implementation of Python
(albeit the most popular one). It is not part of the language.

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


[issue32443] Add Linux's signalfd() to the signal module

2017-12-28 Thread Gregory P. Smith

New submission from Gregory P. Smith :

We should add a wrapper for both signalfd() and a function to read and decode 
the structure from the fd into a dataclass.

The code we need to build such a thing from appears to exist in BSD & MIT 
licensed form in:

PyPI contains two extension module wrappers of just the system call:
 https://pypi.python.org/pypi/signalfd/
 https://pypi.python.org/pypi/python-signalfd

Why add this Linux specific API to the standard library?  I believe I could use 
signalfd() within the subprocess module to get rid of the need to 
busy-loop-poll to see when children have exited on subprocess.Popen.wait() 
calls with a timeout.  [a proof of concept using the above modules would be a 
good idea first]

--
components: Library (Lib)
messages: 309151
nosy: gregory.p.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: Add Linux's signalfd() to the signal module
type: enhancement
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue32420] LookupError : unknown encoding : [0x7FF092395AD0] ANOMALY

2017-12-28 Thread Kaoru Kitamura

Kaoru Kitamura  added the comment:

Does somebody know what causes above?

--
resolution:  -> remind

___
Python tracker 

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



Re: Goto

2017-12-28 Thread Ben Finney
bartc  writes:

> But it's not accessible from the language.

Another way to say that (and the way I said the same thing) is: It
doesn't exist in Python.

-- 
 \ “I went to the museum where they had all the heads and arms |
  `\  from the statues that are in all the other museums.” —Steven |
_o__)   Wright |
Ben Finney

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


Re: Goto

2017-12-28 Thread bartc

On 28/12/2017 21:42, Ben Finney wrote:

Duram  writes:


How to use goto in python?


Step 0: what is goto in Python?

Step 1: that's not something that exists in Python. So why are you
asking how to use something that doesn't exist?


Goto exists in the form of the JUMP_ABSOLUTE byte-code.

But it's not accessible from the language.


--
bartc


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


[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread R. David Murray

R. David Murray  added the comment:

Yes, that's why I said "from our point of view" :)  I know there is usually a 
fork in the practical sense, but we want to make it as easy as practical to 
sync that fork, which includes not breaking things in the python versions 
without good reason.

--

___
Python tracker 

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



[issue32442] Result of pathlib.Path.resolve() with UNC path is not very useful

2017-12-28 Thread Eric V. Smith

Eric V. Smith  added the comment:

I'm not sure how pathlib.Path('Z:\foo') gives an answer with 'foo' in it, since 
'\f' is a formfeed. Is this the exact output that you're showing?

Can you try with r'Z:\foo', 'Z:\\foo', or 'Z:/foo' and see what that produces?

--
nosy: +eric.smith

___
Python tracker 

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



[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread Paul Ganssle

Paul Ganssle  added the comment:

> There is no "fork" involved in other projects using it, from our point of 
> view.

I did not mean "fork" in some judgmental sense, I'm mostly just familiar with 
pypy, but I was under the impression that other projects were *literally* 
forking the standard library as a practical matter. I get the impression that 
other interpreters maintain a patched interpreter often for the purposes of 
adding fixes like the one pointed out in msg309131 which bring the behavior of 
the Python implementation of the standard library into line with the C 
implementations, since the C version is the de facto standard (since most code 
is written and tested only for CPython).

I'd be fine with adding a C alias for `copy`, though as a purely practical 
matter, I strongly suspect that dropping `copy` from the pure Python 
implementation would not be a huge deal, but if that breaks the contract it 
breaks the contract.

--

___
Python tracker 

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



[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread R. David Murray

R. David Murray  added the comment:

Paul Ganssle: Even if Andrew were not suggesting adding copy to the C 
implementation (I have no opinion on that currently), it would still be correct 
to maintain backward compatibility in the python version in the standard 
library.  We do not consider the standard library to be CPython specific, even 
though parts of it are.  There is no "fork" involved in other projects using 
it, from our point of view.  Quite the opposite, where possible.  We have given 
commit rights to developers from other python implementations specifically so 
they can contribute things that improve compatibility in the standard library 
and standard library test suite for those other python implementations.

--
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: PyWin32 installer question

2017-12-28 Thread Paul Moore
On 28 December 2017 at 17:49, Skip Montanaro  wrote:
> pip install py2exe_py2 pypiwin32 Pillow lockfile
> Collecting py2exe_py2
> Could not find a version that satisfies the requirement py2exe_py2
> (from versions: )
>
> That error message isn't telling me much about why the requirement
> isn't satisfied.
>
> The name of the wheel file suggests that it's architecture-independent:
>
> py2exe_py2-0.6.9-cp27-none-win32.whl
>
> Any idea what it's complaining about?

That's not an architecture-independent file. The Wheel spec gives all
the details, but "cp27" (as opposed to "py27") means it's CPython only
(which usually means it's got a C extension) and "win32" is 32-bit
only ("win_amd64" is the tag for 64-bit Windows). So the problem is
that the py2exe_py2 maintainer doesn't supply a 64-bit build. You
could ask the maintainers if they could supply a 64-bit build. You may
be able to build your own copy, but without a Windows system, doing so
on Appveyor will be a real pain. Another option is to use Christoph
Gohlke's builds, from
https://www.lfd.uci.edu/~gohlke/pythonlibs/#py2exe - you have to
download the wheel file manually (the site doesn't support automated
downloads) and then upload it to Appveyor somehow (maybe by keeping a
copy of the wheel in the project repo). Also the version there is
0.6.10a1 which looks like an alpha rather than the last official
release. So I guess there may be issues with that. Worst case scenario
would be to switch to something other than py2exe - cx_Freeze seems
similar and pretty good, and it *does* ship 64-bit Python 2.7 wheels.
But that's obviously a non-trivial task.

Welcome to the bad old days of trying to find Windows binaries for
Python packages :-( I'd strongly recommend moving to Python 3, as the
situation is immensely improved there - most projects ship Python 3
binary wheels, and "pip install" just works in many cases. But I
appreciate that doesn't help much for you. Sorry - hopefully one of
the other options above will help.

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


[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Yes.
For designing from scratch copy() is not necessary but if we have it for decade 
-- better to unify pure Python and C implementation by adding missing methods.

--

___
Python tracker 

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



[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread Paul Ganssle

Paul Ganssle  added the comment:

@Andrew Are you suggesting that a `copy` method be *added* to the C 
implementation, as an alias to __copy__? Because it makes no sense to keep the 
pure Python and C implementations out of sync just so that it's easier for 
projects forking the pure Python implementation to maintain backwards 
compatibility with their earlier implementations.

--

___
Python tracker 

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



[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

For derivative Python implementation there is a standard strategy: they uses a 
copy of CPython standard library.

Tthat's why any new module should have a pure Python implementation and that's 
why https://www.python.org/dev/peps/pep-0399/ exists.

Jython has copy() method as well. IronPython has it. I doubt if an 
implementation without xml.etree.ElementTree.Element.copy exists at all.

The method removal breaks backward compatibility without a reason, __copy__ 
alias is valuable and backward compatible change.

--

___
Python tracker 

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



[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread Paul Ganssle

Paul Ganssle  added the comment:

> I mean dropping `.copy()` breaks not only compatibility between pure python 
> versions but also between pypy releases and pypy/CPython code.
That's why I suggest to keep `.copy()` as an alias for `__copy__()`.

If the main issue is that pypy users have been using this, can't pypy just keep 
an alias for `copy` around, possibly with a DeprecationWarning?

--
nosy: +p-ganssle

___
Python tracker 

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



Re: Goto

2017-12-28 Thread Ben Finney
Duram  writes:

> How to use goto in python?

Step 0: what is goto in Python?

Step 1: that's not something that exists in Python. So why are you
asking how to use something that doesn't exist?

-- 
 \“[R]ightful liberty is unobstructed action, according to our |
  `\will, within limits drawn around us by the equal rights of |
_o__) others.” —Thomas Jefferson, 1819 |
Ben Finney

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


[issue10381] Add timezone support to datetime C API

2017-12-28 Thread Paul Ganssle

Change by Paul Ganssle :


--
keywords: +patch
pull_requests: +4919
stage: needs patch -> patch review

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I don't expect any differences in macrobenchamrks. try/except/finally are 
rarely used in tight loops.

--

___
Python tracker 

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



[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

I mean dropping `.copy()` breaks not only compatibility between pure python 
versions but also between pypy releases and pypy/CPython code.
That's why I suggest to keep `.copy()` as an alias for `__copy__()`.

--

___
Python tracker 

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



Re: Goto

2017-12-28 Thread alister via Python-list
On Thu, 28 Dec 2017 00:58:48 -0200, Duram wrote:

> How to use goto in python?
> 
> ---
> This email has been checked for viruses by AVG.
> http://www.avg.com

Dont!
actually you cant - there isn't one*

*at least not in the core language no doubt some sick person will have 
manager to hack together some sort of dodgy code to simulate it if you 
look hard enough)



-- 
Bigmac's brother was reliably believed to be in the job of moving video
recorders around in an informal way.
(Only You Can Save Mankind)
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Yes, those benchmarks look fine. Have you tried with the benchmarks suite?

--

___
Python tracker 

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



[issue17611] Move unwinding of stack for "pseudo exceptions" from interpreter to compiler.

2017-12-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Results of microbenchmarks:

$ ./python -m perf timeit -s 'a = list(range(1000))' -- 'for i in a: pass'
Mean +- std dev: 6.31 us +- 0.09 us

$ ./python -m perf timeit -s 'a = list(range(1000))' -- '
for i in a:
try: pass
finally: pass
'
Unpatched:  Mean +- std dev: 16.3 us +- 0.2 us
PR 2827:Mean +- std dev: 16.2 us +- 0.2 us
PR 4682:Mean +- std dev: 16.2 us +- 0.2 us
PR 5006:Mean +- std dev: 14.5 us +- 0.4 us

$ ./python -m perf timeit -s 'a = list(range(1000))' -- '
for i in a:
try: continue
finally: pass
'
Unpatched:  Mean +- std dev: 24.0 us +- 0.5 us
PR 2827:Mean +- std dev: 11.9 us +- 0.1 us
PR 4682:Mean +- std dev: 12.0 us +- 0.1 us
PR 5006:Mean +- std dev: 19.0 us +- 0.3 us

$ ./python -m perf timeit -s 'a = list(range(1000))' -- '
for i in a:
while True:
try: break
finally: pass
'
Unpatched:  Mean +- std dev: 25.9 us +- 0.5 us
PR 2827:Mean +- std dev: 11.9 us +- 0.1 us
PR 4682:Mean +- std dev: 12.0 us +- 0.1 us
PR 5006:Mean +- std dev: 18.9 us +- 0.1 us


PR 2827 and PR 4682 have the same performance. The overhead of the finally 
block is smaller in PR 5006, perhaps because BEGIN_FINALLY pushes 1 NULL 
instead of 6 NULLs. CALL_FINALLY adds 4.5 ns in the latter too examples. This 
overhead could be decreased by using special cache for Python integers that 
represent return addresses or using separate stack for return addresses. But 
this looks as an overkill to me now. 4.5 ns is pretty small overhead, the 
simple `i = i` have the same timing.

--

___
Python tracker 

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



RE: Python Software Installation - Failed

2017-12-28 Thread Kirankumar Reddy Polu
Hi,

I am trying to install Python 3.6.4 in my laptop. I am getting the following 
error. I also attached failure log as well in the mail. I could not change the 
path. It is automatically installing in C drive. Might be, this is restricted 
drive, so we got errors. I am not sure, but let me know as well to do the path 
changes at D drive.

Please suggest me to do the installation steps without failures of the attached 
logs.

[cid:image001.png@01D37FFA.E81295C0]


Regards,
Kiran Polu


Disclaimer:  This message and the information contained herein is proprietary 
and confidential and subject to the Tech Mahindra policy statement, you may 
review the policy at http://www.techmahindra.com/Disclaimer.html 
 externally 
http://tim.techmahindra.com/tim/disclaimer.html 
 internally within 
TechMahindra.


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


Goto

2017-12-28 Thread Duram

How to use goto in python?

---
This email has been checked for viruses by AVG.
http://www.avg.com

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


[issue32442] Result of pathlib.Path.resolve() with UNC path is not very useful

2017-12-28 Thread Tzu-ping Chung

New submission from Tzu-ping Chung :

The behaviour of os.path.abspath() and pathlib.Path.resolve() is a different 
when dealing with a path on a UNC share (on Windows):

>>> import os, pathlib
>>> path = pathlib.Path('Z:\foo')
>>> path.resolve()
WindowsPath('//host/share/foo')
>>> os.path.abspath(path)
'Z:\\foo'

This is not necessarily a problem by itself, just a consequence of calling 
different APIs underneath (although it probably worths a mention in 
documentation). The real problem is that the UNC path is not really useful 
anywhere in the Python standard library (AFAIK), and there’s no way to turn the 
it (back) into network drive once you call resolve(). The only way to get a 
network drive path is to

>>> pathlib.Path(os.path.abspath(path))

Some possibile solutions:

1. Change the behaviour of resolve() to return the network drive path instead. 
This would be the most straightforward, API-wise, but is backward-incompatible, 
and maybe the original implementation did this on purpose?
2. Add a as_absolute() to pathlib.Path. On Windows this would mirror the result 
of os.path.abspath(); on POSIX this would probably be identical to resolve().
3. Add an argument to resolve()? This is essentially the same as 2., just 
interfaced differently.

--
components: Library (Lib), Windows
messages: 309137
nosy: paul.moore, steve.dower, tim.golden, uranusjr, zach.ware
priority: normal
severity: normal
status: open
title: Result of pathlib.Path.resolve() with UNC path is not very useful
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



[issue10381] Add timezone support to datetime C API

2017-12-28 Thread Paul Ganssle

Change by Paul Ganssle :


--
nosy: +p-ganssle

___
Python tracker 

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



[issue17305] IDNA2008 encoding missing

2017-12-28 Thread Greg Lindahl

Change by Greg Lindahl :


--
nosy: +wumpus

___
Python tracker 

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



[issue32438] PyLong_ API cleanup

2017-12-28 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

See also issue17576. And there may be other related issues.

--
nosy: +lemburg, mark.dickinson, serhiy.storchaka, stutzbach
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: PyWin32 installer question

2017-12-28 Thread Skip Montanaro
Thanks for the help, Paul.

> When I took a quick look at the code, it seemed to be based on a
> pretty old version of Python. What version are you using?

Yes, last time a Windows installer was created, Python 2.5 was still
in vogue. I switched things to 2.7 with (so far) no obvious problems.

I eventually got past the pywin32 install hassles you referred to when
I stumbled on the pypiwin32 package:

https://pypi.python.org/pypi/pypiwin32/220

On the PyPI site, it does, indeed, look like only Python 3 is
supported, but it seemed to download and install a 2.7 version. This
is from my latest 32-bit build:

pip install py2exe_py2 pypiwin32 Pillow lockfile
Collecting py2exe_py2
Downloading py2exe_py2-0.6.9-cp27-none-win32.whl (134kB)
Collecting pypiwin32
Downloading pypiwin32-219-cp27-none-win32.whl (6.7MB)
Collecting Pillow
Downloading Pillow-4.3.0-cp27-cp27m-win32.whl (1.3MB)
Collecting lockfile
Downloading lockfile-0.12.2-py2.py3-none-any.whl

(I guess it fell back to 219 automatically. Clever tool, that pip...)

So, I'm past that hurdle, and eventually got a successful 32-bit build:

https://ci.appveyor.com/project/smontanaro/spambayes/build/job/5pflj8b6t3qn0naw/artifacts

but now I'm fumbling around with 64-bit (my holy grail, as most
Outlook users are running a 64-bit version, at least based on the
install questions we get on the SpamBayes mailing list):

pip install py2exe_py2 pypiwin32 Pillow lockfile
Collecting py2exe_py2
Could not find a version that satisfies the requirement py2exe_py2
(from versions: )

That error message isn't telling me much about why the requirement
isn't satisfied.

The name of the wheel file suggests that it's architecture-independent:

py2exe_py2-0.6.9-cp27-none-win32.whl

Any idea what it's complaining about?

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


[issue32441] os.dup2 should return the new fd

2017-12-28 Thread Benjamin Peterson

New submission from Benjamin Peterson :

os.dup2 currently always None. However, the underlying standard Unix function 
returns the new file descriptor (i.e., the second argument) on success. We 
should follow that convention, too.

--
components: Extension Modules
keywords: easy
messages: 309135
nosy: benjamin.peterson
priority: low
severity: normal
stage: needs patch
status: open
title: os.dup2 should return the new fd
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: PyWin32 installer question

2017-12-28 Thread Paul Moore
When I took a quick look at the code, it seemed to be based on a
pretty old version of Python. What version are you using? If it's 2.7
(or better still, Python 3!) then you should have pip available. In
which case you may be better off using pypiwin32, which is a
rebundling of pywin32 as a wheel. "python -m pip install pypiwin21"
should work for you. You may need to force the version to be 219, as
there's only Python 3.6 wheels for version 220 (do this as "python -m
pip install pypiwin32==219") - but I don't think you'll need this, pip
should limit itself to compatible wheels.

Unfortunately, pywin32 is one of the worst extensions to install, as
the project doesn't supply official wheels, and some of the COM stuff
needs registration, which in the wininst script is handled by a
post-install step, but I've no idea how you do that with a wheel - you
may need to ask the project maintainers for advice.

Paul

On 27 December 2017 at 14:58, Skip Montanaro  wrote:
> I'm fiddling around with Appveyor, trying to build a Windows installer
> for SpamBayes. This is complicated by two facts:
>
> 1. I don't know squat about Windows.
>
> 2. I don't have access to a Windows command line.
>
> Consequently, every new attempt requires a change to appveyor.yml and
> a git push command. Rather slow going. My latest Appveyor build number
> is 59. Most of the changes were simple fixes for syntax errors.
>
> I got to the point where I (finally!) was able to successfully
> download the appropriate pywin32 installer, but executing it just
> hangs. I sort of assume it's asking os.devnull for something. Alas, I
> couldn't find any sort of command line flags for the installer itself
> in the pywin32 code. I've tried
>
> pywin32.exe /h
>
> but that just sits there (ignores that flag?) and
>
> pywin32.exe /?
>
> which produced some inscrutable output.
>
> Is there some way to coax it into giving me some help and exiting?
>
> Thanks,
>
> Skip
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


win32wnet.WNetAddConnection2 issue

2017-12-28 Thread joanazpeitia
Hi guys,

I've seen a few posts about this topic but could not find the solution. I am 
trying to connect a drive to a network drive using win32wnet.WNetAddConnection2 
but I might be missing something because it does not work.
This is what I have.


import os
import win32api
import win32wnet
import win32netcon,win32wnet


ynetworkPath = 'LAMPSERVER_RB\\resources_server\\'
znetworkPath = 'LAMPSERVER\\lampserver\\_PROJECTS\\'
yDrive = 'Y:'
user='aa'
password='bb'


def mapResourcesDrive():
print ynetworkPath
if (os.path.exists(yDrive)):
print "Y drive is already mapped"
if (os.path.exists(ynetworkPath)):
print ynetworkPath, " is found..."
print "Trying to map ", ynetworkPath, " on to ", yDrive, " ."
try:
win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK, yDrive, 
ynetworkPath, None, user, password)
print "connection established succesfully"
except:
print "Unexpected error..."
return -1
print "Mapping successful"
return 1
else:
print "Network path unreachable..."


mapResourcesDrive()


If anyone can give me an idea of why 

win32wnet.WNetAddConnection2(win32netcon.RESOURCETYPE_DISK, yDrive, 
ynetworkPath, None, user, password)

is not working owuld be much appreciatted.
Many thanks,

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


[issue17258] multiprocessing.connection challenge implicitly uses MD5

2017-12-28 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Indeed, we probably want a flexible handshake mechanism.  This needn't be very 
optimized: probably a magic number followed by a JSON-encoded dict is 
sufficient.

(of course, several years down the road, someone will engineer a downgrade 
attack)

--
nosy: +pitrou
status: pending -> open

___
Python tracker 

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



[issue32440] Use HTTPS in help()

2017-12-28 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

Thanks!

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue32440] Use HTTPS in help()

2017-12-28 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset 6eb232c52a03e31fc47842e70fc7833198744c2b by Mariatta (Miss 
Islington (bot)) in branch '3.6':
bpo-32440: Update the docs URL to https in help() (GH-5030) (GH-5031)
https://github.com/python/cpython/commit/6eb232c52a03e31fc47842e70fc7833198744c2b


--

___
Python tracker 

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



[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread Gordon P. Hemsley

Gordon P. Hemsley  added the comment:

Two notes:

* It appears that pypy is based on no more recent than Python 3.5, so this 
wouldn't immediately break them. (3.6 support is maybe in development?)
* pypy appears to have already made other adjustments due to the differences 
between the Python and C implementations: 
https://bitbucket.org/pypy/pypy/diff/lib-python/3/xml/etree/ElementTree.py?diff2=0939e3a8a08d=py3.5

That said, I'm neutral on the subject. I'm happy to implement whichever option 
you decide on.

--

___
Python tracker 

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



[issue32440] Use HTTPS in help()

2017-12-28 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4918

___
Python tracker 

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



[issue32440] Use HTTPS in help()

2017-12-28 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:


New changeset e5681b9822c633c77ddfeb94585d58895e0ecff5 by Mariatta (oldk) in 
branch 'master':
bpo-32440: Update the docs URL to https in help() (GH-5030)
https://github.com/python/cpython/commit/e5681b9822c633c77ddfeb94585d58895e0ecff5


--
nosy: +Mariatta

___
Python tracker 

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



Re: GUI user input to function

2017-12-28 Thread Chris Angelico
On Thu, Dec 28, 2017 at 11:06 PM, Nico Vogeli  wrote:
> Am Donnerstag, 28. Dezember 2017 12:59:24 UTC+1 schrieb Chris Angelico:
>> On Thu, Dec 28, 2017 at 8:38 PM, Nico Vogeli  wrote:
>> > Withs test, this return a correct value for the two x functions:
>> >
>> > from sympy import symbols
>> >
>> > x = symbols('x')
>> > f1 = eval(input('function 1 '))
>> > f2 = eval(input('function 2 '))
>> >
>>
>> What are you typing as input? It's hard to grok your code without knowing 
>> that.
>>
>> ChrisA
>
> I'm sorry! User input would look like this for example: x**2 + 3*x or x**3
>

Cool. That's an expression, but it isn't a function. To make that into
a function, you need to prefix it with the lambda keyword.

So you should be able to construct functions like this:

f1 = eval("lambda x: " + input("function 1: "))

Then, when you type "x**3", Python evaluates "lambda x: x**3", which
is a function.

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


Re: Python goto

2017-12-28 Thread Skip Montanaro
Jorge> I would like to know if there is a goto command or something similar that
Jorge> I can use in Python.

Ned> Python does not have a goto statement. You have to use structured
Ned> statements: for, while, try/except, yield, return, etc.

Though it appears some wag has used function decorators to implement
goto statements:

https://pypi.python.org/pypi/goto-statement/1.1

Rather clever, it seems.

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


[issue32432] [BUG] Python vs Macbook High Sierra 10.13.2

2017-12-28 Thread Felipe Filgueira Barral

Felipe Filgueira Barral  added the comment:

Tks Ronald, solve the problem! =)

--

___
Python tracker 

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



[issue32432] [BUG] Python vs Macbook High Sierra 10.13.2

2017-12-28 Thread Felipe Filgueira Barral

Change by Felipe Filgueira Barral :


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

___
Python tracker 

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



Re: Python goto

2017-12-28 Thread Ned Batchelder

On 12/28/17 6:43 AM, jorge.conr...@cptec.inpe.br wrote:



Hi,

I would like to know if there is a goto command or something similar 
that I can use in Python.




Python does not have a goto statement. You have to use structured 
statements: for, while, try/except, yield, return, etc.


If you show an example of where you would like to use a goto, we can 
help find a different way.


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


[issue32440] Use HTTPS in help()

2017-12-28 Thread Old K

Old K  added the comment:

I have created a pull request at:

https://github.com/python/cpython/pull/5030

--

___
Python tracker 

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



[issue32440] Use HTTPS in help()

2017-12-28 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



Re: GUI user input to function

2017-12-28 Thread Nico Vogeli
Am Donnerstag, 28. Dezember 2017 12:59:24 UTC+1 schrieb Chris Angelico:
> On Thu, Dec 28, 2017 at 8:38 PM, Nico Vogeli  wrote:
> > Withs test, this return a correct value for the two x functions:
> >
> > from sympy import symbols
> >
> > x = symbols('x')
> > f1 = eval(input('function 1 '))
> > f2 = eval(input('function 2 '))
> >
> 
> What are you typing as input? It's hard to grok your code without knowing 
> that.
> 
> ChrisA

I'm sorry! User input would look like this for example: x**2 + 3*x or x**3

Regards

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


[issue32440] Use HTTPS in help()

2017-12-28 Thread Old K

New submission from Old K :

In python3, in the output of help(), there is link
http://docs.python.org/3.6/tutorial/.
It should be made into https.

There are already some issues about changing http links to https:
https://bugs.python.org/issue25910
https://bugs.python.org/issue26736

But this link is still unchanged.

--
assignee: docs@python
components: Documentation
messages: 309127
nosy: Old K, docs@python
priority: normal
severity: normal
status: open
title: Use HTTPS in help()
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



[issue22273] abort when passing certain structs by value using ctypes

2017-12-28 Thread Vinay Sajip

Vinay Sajip  added the comment:

Yes, the patch needs improving as per the suggestion in msg288493 (not had the 
time since to do any work on it), followed by a review of the changes.

--

___
Python tracker 

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



Re: GUI user input to function

2017-12-28 Thread Chris Angelico
On Thu, Dec 28, 2017 at 8:38 PM, Nico Vogeli  wrote:
> Withs test, this return a correct value for the two x functions:
>
> from sympy import symbols
>
> x = symbols('x')
> f1 = eval(input('function 1 '))
> f2 = eval(input('function 2 '))
>

What are you typing as input? It's hard to grok your code without knowing that.

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


Python goto

2017-12-28 Thread jorge . conrado



Hi,

I would like to know if there is a goto command or something similar 
that I can use in Python.


Thanks,

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


[issue32432] [BUG] Python vs Macbook High Sierra 10.13.2

2017-12-28 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

Did you install ActiveState's distribution of Tk as described here: 
https://www.python.org/download/mac/tcltk/ ?

Sadly enough the version of Tcl/Tk shipped by Apple contains a number of bugs 
that cause problems for Tkinter applications like IDLE.

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

pypy for example has Element.copy()

--

___
Python tracker 

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



[issue32439] Clean up the code for compiling comparison expressions

2017-12-28 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue32439] Clean up the code for compiling comparison expressions

2017-12-28 Thread Serhiy Storchaka

New submission from Serhiy Storchaka :

The proposed PR cleans up the code for compiling comparison expressions. It 
makes it similar to specialized copy added in bpo-30501.

--
assignee: serhiy.storchaka
components: Interpreter Core
messages: 309123
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Clean up the code for compiling comparison expressions
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



[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread Julien Palard

Julien Palard  added the comment:

I don't agree with the API breakage, the C implementation of the module does 
not expose copy(), so code using copy() is already broken (since 2005) in cases 
the C implementation is used.

I also expect the C implementation to be used almost anywhere, but I may be 
wrong on this point: in which case the Python implementation may still be used?

--

___
Python tracker 

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



[issue17305] IDNA2008 encoding missing

2017-12-28 Thread Andrew Svetlov

Change by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue32424] Rename copy() to __copy__() in xml.etree.ElementTree.Element Python implementation

2017-12-28 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Agree with Srinivas

--
nosy: +asvetlov

___
Python tracker 

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



[issue31639] http.server and SimpleHTTPServer hang after a few requests

2017-12-28 Thread Julien Palard

Julien Palard  added the comment:

Glenn you're right I modified my PR.

--

___
Python tracker 

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



[issue32438] PyLong_ API cleanup

2017-12-28 Thread Erik Bray

New submission from Erik Bray :

Per Serhiy's comment in this thread 
https://mail.python.org/pipermail/python-ideas/2017-December/048413.html (which 
I agree with), several of the PyLong_ functions have behavior carried over from 
Python 2 of calling __int__ on their arguments if the input is not a 
PyLongObject:

PyLong_AsLong
PyLong_AsLongAndOverflow
PyLong_AsLongLong
PyLong_AsLongLongAndOverflow
PyLong_AsUnsignedLongMask
PyLong_AsUnsignedLongLongMask

This behavior should probably be deprecated, and eventually removed.  
Interfaces that should accept generic number-like objects should use the 
PyNumber API instead.

--
components: Interpreter Core
messages: 309119
nosy: erik.bray
priority: normal
severity: normal
status: open
title: PyLong_ API cleanup
type: behavior

___
Python tracker 

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



[issue32437] UnicodeError: 'IDNA does not round-trip'

2017-12-28 Thread Berker Peksag

Berker Peksag  added the comment:

There is an open issue about adding IDNA 2008 support: Issue 17305. Closing 
this one as a duplicate of that issue.

--
nosy: +berker.peksag
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDNA2008 encoding missing

___
Python tracker 

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



GUI user input to function

2017-12-28 Thread Nico Vogeli
Hello again

I think my question got lost in all the others raised, so here I am again :P



So, I tried my best, was looking into the eval and exec function, but still no 
succsess..

Maybe it helps when I provide the code I want to implement:

def newton_verfahren(self):
if self.cB_1.currentText() == 'Newton':
   
x0 = self.newton_x.text()
f1 = self.func_1.text()
f2 = self.func_2.text()
tol = self.newton_tol.text()
n = self.newton_n.text()
k = Numerik_Funktionen.newton(int(x0), eval(f1), eval(f2),
  int(tol), int(n))
k1 = str(k[0])
k2 = str(k[1])
k3 = str(k[2])
self.ausgabe.setText('Startwert -> x0: '+ k1 + "\n" +
  'Anzahl Iterationen: ' + k2 +"\n" +
  'f(x~): ' + k3)  

Notice that cB_1 is a combobox, newton_x, func_1, func_2, newton_tol and 
newton_n are all QLineEdits.

The code above doesn't work, so I've opend a 'test' file to just play around 
with the functions.

Withs test, this return a correct value for the two x functions:

from sympy import symbols

x = symbols('x')
f1 = eval(input('function 1 '))
f2 = eval(input('function 2 '))

But now I get and error from the imported module in the line where the 
abs(f(x)) > tol.

It states that the 'Pow' object is not callable. And now I don't know how to 
proceed, I can't figure out a way to make the call to the imported module:

x = symbols('x')
def newton(x0, f, fx, tol, n = 2):
'''
Näherung zur lösung einer Gleichung mit dem Newton-Verfahren
x0 = Startwert
f = zu lösende Funktion
fx = Ableitung der Funktion
   
'''

   
x = x0
k = 0
   
while n > k and abs(f(x)) > tol:
k += 1
x = x - f(x)/fx(x)
print('x', k, '\n', x)
   
print('Startwert -> x0', '\n', x0)
print('Anzahl Iterationen', '\n', k)
print('f(x~)', '\n', f(x))
print('Näherungswert -> x~', '\n', x)

 
return x0, k, f(x), x

Regards

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


[issue32437] UnicodeError: 'IDNA does not round-trip'

2017-12-28 Thread Andrew Svetlov

Change by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue32437] UnicodeError: 'IDNA does not round-trip'

2017-12-28 Thread Марк Коренберг

New submission from Марк Коренберг :

First: This is the bug:

In [1]: 'großhandel-shop'.encode('idna')
Out[1]: b'grosshandel-shop'

This lead to this:

'xn--einla-pqa'.decode('idna')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/encodings/idna.py", line 214, in decode
result.append(ToUnicode(label))
  File "/usr/lib/python3.6/encodings/idna.py", line 139, in ToUnicode
raise UnicodeError("IDNA does not round-trip", label, label2)
UnicodeError: ('IDNA does not round-trip', b'xn--einla-pqa', b'einlass')


https://stackoverflow.com/questions/9806036/idna-does-not-round-trip


xn--grohandel-shop-2fb has been correctly encoded by IDNA 2008 (which is 
correct in Germany/DENIC since a while). Your Python very likely tries to 
decode it using the old IDNA 2003, which doesn't know 'ß'. see 
denic.de/en/know-how/idn-domains

--
components: Unicode
messages: 309117
nosy: ezio.melotti, socketpair, vstinner
priority: normal
severity: normal
status: open
title: UnicodeError: 'IDNA does not round-trip'
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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