[issue30206] data parameter for binascii.b2a_base64 is not positional-only

2017-04-30 Thread Xiang Zhang

Changes by Xiang Zhang :


--
resolution:  -> fixed
stage:  -> 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



[ANN] Second PyCon Israel June 11-14, 2017

2017-04-30 Thread Miki Tebeka
Hi All,

The second PyCon Israel will take place June 11-14, 2017.
* 11 June Django girls workshop at Red Hat Israel offices in Raanana
* 12-13 June PyCon Israel main event at Wohl center
* 14 June PyCon Israel workshops and sprints

We still have some sponsorship spots available, great recruiting and branding 
opportunity. Also the general session CFP is still open.

Read more at http://il.pycon.org/2017/

See you there,
--
The PyCon Israel Team
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: MCOW package

2017-04-30 Thread Steve D'Aprano
On Mon, 1 May 2017 01:01 pm, Metallicow wrote:

> I finally uploaded my wx/lib/mcow package.
> It has many widgets and mixins and probably more to come.

Congratulations! What does it do?




-- 
Steve
Emoji: a small, fuzzy, indistinct picture used to replace a clear and
perfectly comprehensible word.

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


[issue30196] Add __matmul__ to collections.Counter

2017-04-30 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
resolution:  -> rejected
stage: test needed -> 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



MCOW package

2017-04-30 Thread Metallicow
I finally uploaded my wx/lib/mcow package.
It has many widgets and mixins and probably more to come.


It has been extensively tested on Windows and at least tested on a linux flavor.
It would be nice if I could get some mac testing also. :)

https://github.com/Metallicow/MCOW
-- 
https://mail.python.org/mailman/listinfo/python-list


MCOW package

2017-04-30 Thread Metallicow
I finally uploaded my wx/lib/mcow package.
It has many widgets and mixins and probably more to come.


It has been extensively tested on Windows and at least tested on a linux flavor.
It would be nice if I could get some mac testing also. :)

https://github.com/Metallicow/MCOW
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tempname.mktemp functionality deprecation

2017-04-30 Thread Tim Chase
On 2017-05-01 08:41, Cameron Simpson wrote:
> On 30Apr2017 06:52, Tim Chase  wrote:
> >> > - use a GUID-named temp-file instead for less chance of
> >> > collision?
> 
> You could, but mktemp is supposed to robustly perform that task,
> versus "very very probably".

Though with the potential of its race-condition, mktemp() isn't a much
stronger guarantee.  A GUID seems like the best route.

> >> > - I happen to already have a hash of the file contents, so use
> >> >   the .hexdigest() string as the temp-file name?
> 
> Hashes collide. (Yes, I know that for your purposes we consider
> that they don't; I have a very similar situation of my own). And
> what if your process is running twice, or leaves around a previous
> temp file by accident (or interruption) _or_ the file tree contains
> filenames named after the hash of their content (not actually
> unheard of)?

In both case #1 (a *file* happens to have the name of the SHA256 hash,
but has different file contents) and case #2 (another process running
generates a *link* with the SHA256 of the matching content), the
os.link() should fail with the EEXISTS which I'm okay with.
Likewise, if there's an interruption, I'd rather have the stray
SHA-named link floating around than lose an existing file-name.

> What about some variation on:
> 
>   from tempfile import NamedTemporaryFile
>   ...
>   with NamedTemporaryFile(dir=your_target_directory) as T:
>   use T.name, and do your rename/unlink in here

As mentioned in my follow-up (which strangely your reply came in with
a References header referencing), the NamedTemporaryFile creates the
file on-disk, which means os.link(source, T.name) fails with the
EEXISTS.

-tkc




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


Re: tempname.mktemp functionality deprecation

2017-04-30 Thread Tim Chase
On 2017-05-01 09:15, Ben Finney wrote:
> I reported this – for a different use case – in issue26362 [0]
> .
> 
> The suggested solutions in the documentation do not address the use
> case described there; and they do not address the use case you've
> described here either.
> 
> Would you be kind enough to update that issue with a description of
> your use case as well?

Done, linking to this thread:  http://bugs.python.org/msg292648

-tkc



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


[issue26362] Approved API for creating a temporary file path

2017-04-30 Thread Tim Chase

Tim Chase added the comment:

As requested by Ben Finney[1], adding my use-case here.  I'm attempting to make 
a hard-link from "a" to "b", but if "b" exists, os.link() will fail with an 
EEXISTS.  I don't want to do

 os.unlink("b")
 # power-outage here means "b" is gone
 os.link("a", "b")

I can do something like

  temp_name = tempfile.mktemp(dir=".")
  os.link("a", temp_name)
  try:
os.rename(temp_name, "b") # docs guarantee this is atomic
  except OSError:
os.unlink(temp_name)

but mktemp() is marked as deprecated.

I'm okay with the stray temp-file floating around to clean up in the event of 
power-loss after the os.link() but before the os.unlink() call, as is new info, 
not disposing of existing file-names



[1] https://mail.python.org/pipermail/python-list/2017-April/721641.html

--
nosy: +gumnos

___
Python tracker 

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



[issue29679] Add @contextlib.asynccontextmanager

2017-04-30 Thread Yury Selivanov

Yury Selivanov added the comment:


New changeset 2e624690bd74071358566300b7ef0bc45f444a30 by Yury Selivanov (Jelle 
Zijlstra) in branch 'master':
bpo-29679: Implement @contextlib.asynccontextmanager (#360)
https://github.com/python/cpython/commit/2e624690bd74071358566300b7ef0bc45f444a30


--

___
Python tracker 

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



[issue30200] tkinter ListboxSelect

2017-04-30 Thread Louie Lu

Louie Lu added the comment:

ah, I think Terry point out the problem behind why my 2.7 and Frank's 2.7 have 
different behavior.

I'm using tk 8.6.6-1 on Linux, and it may be the problem from tk version.

--

___
Python tracker 

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



Re: tempname.mktemp functionality deprecation

2017-04-30 Thread Dan Stromberg
On Sat, Apr 29, 2017 at 11:45 AM, Tim Chase
 wrote:
> Working on some deduplication code, I want do my my best at
> performing an atomic re-hard-linking atop an existing file, akin to
> "ln -f source.txt dest.txt"
>
> However, when I issue
>
>   os.link("source.txt", "dest.txt")
>
> it fails with an OSError (EEXISTS).  This isn't surprising as it's
> documented.  Unfortunately, os.link doesn't support something like
>
>   os.link("source.txt", "dest.txt", force=True)

FWIW, ln -f appears to unlink on Linux Mint 18 (GNU coreutils 8.25):
$ strace -f ln -f file file2 2>&1 | tail -15
below cmd output started 2017 Sun Apr 30 04:47:53 PM PDT
munmap(0x7f804fcb4000, 147404)  = 0
brk(NULL)   = 0x225c000
brk(0x227d000)  = 0x227d000
stat("file2", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lstat("file", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lstat("file2", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
linkat(AT_FDCWD, "file", AT_FDCWD, "file2", 0) = -1 EEXIST (File exists)
unlink("file2") = 0
linkat(AT_FDCWD, "file", AT_FDCWD, "file2", 0) = 0
lseek(0, 0, SEEK_CUR)   = -1 ESPIPE (Illegal seek)
close(0)= 0
close(1)= 0
close(2)= 0
exit_group(0)   = ?
+++ exited with 0 +++

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


Re: tempname.mktemp functionality deprecation

2017-04-30 Thread Ben Finney
Tim Chase  writes:

> Unfortunately, tempfile.mktemp() is described as deprecated since 2.3
> (though appears to still exist in the 3.4.2 that is the default Py3 on
> Debian Stable). While the deprecation notice says "In version 2.3 of
> Python, this module was overhauled for enhanced security. It now
> provides three new functions, NamedTemporaryFile(), mkstemp(), and
> mkdtemp(), which should eliminate all remaining need to use the
> insecure mktemp() function", as best I can tell, all of the other
> functions/objects in the tempfile module return a file object, not a
> string suitable for passing to link().

The problem you describe is that ‘tmpfile.mktemp’ is deprecated, but
there is no other supported standard-library API which does its job.

I reported this – for a different use case – in issue26362 [0]
.

The suggested solutions in the documentation do not address the use case
described there; and they do not address the use case you've described
here either.

Would you be kind enough to update that issue with a description of your
use case as well?


[0] The issue currently has a message from me, over a year ago, saying
that I will “work on a patch soon”. I'd welcome someone else taking
that job.

-- 
 \ “Books and opinions, no matter from whom they came, if they are |
  `\ in opposition to human rights, are nothing but dead letters.” |
_o__)  —Ernestine Rose |
Ben Finney

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


Re: tempname.mktemp functionality deprecation

2017-04-30 Thread Cameron Simpson

On 30Apr2017 06:52, Tim Chase  wrote:

On 2017-04-29 20:51, Devin Jeanpierre wrote:

On Sat, Apr 29, 2017 at 11:45 AM, Tim Chase wrote
> So which route should I pursue?
> - go ahead and use tempfile.mktemp() ignoring the deprecation?


I'd be tempted to. But...


> - use a GUID-named temp-file instead for less chance of collision?


You could, but mktemp is supposed to robustly perform that task, versus "very 
very probably".



> - I happen to already have a hash of the file contents, so use
>   the .hexdigest() string as the temp-file name?


Hashes collide. (Yes, I know that for your purposes we consider that they 
don't; I have a very similar situation of my own). And what if your process is 
running twice, or leaves around a previous temp file by accident (or 
interruption) _or_ the file tree contains filenames named after the hash of 
their content (not actually unheard of)?



> - some other solution I've missed?


What about some variation on:

 from tempfile import NamedTemporaryFile
 ...
 with NamedTemporaryFile(dir=your_target_directory) as T:
 use T.name, and do your rename/unlink in here

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


[issue30145] Create a How to or Tutorial documentation for asyncio

2017-04-30 Thread Yury Selivanov

Yury Selivanov added the comment:

> The problem is that Python stdlib is quite limited: no HTTP, no SQL client,
etc. An external tutorial can use 3rd party modules like aiohttp.

Even without aiohttp we can show how to use asyncio correctly. I agree with 
Mariatta that we should have a tutorial etc. Working on it.

--

___
Python tracker 

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



[issue30145] Create a How to or Tutorial documentation for asyncio

2017-04-30 Thread STINNER Victor

STINNER Victor added the comment:

Mariatta Wijaya added the comment:

I think it will still be useful to have an authoritative tutorial within
CPython docs.

The problem is that Python stdlib is quite limited: no HTTP, no SQL client,
etc. An external tutorial can use 3rd party modules like aiohttp.

--

___
Python tracker 

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



[issue30200] tkinter ListboxSelect

2017-04-30 Thread Frank Pae

Frank Pae added the comment:

I am not a profi, just a normal user, i do what i can so good i can

I would like to thank all python developers

(AND: I think your last question ist the right question)

--
resolution:  -> not a bug
stage: test needed -> 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



[issue30218] shutil.unpack_archive doesn't support PathLike

2017-04-30 Thread Jelle Zijlstra

Changes by Jelle Zijlstra :


--
pull_requests: +1476

___
Python tracker 

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



[issue30218] shutil.unpack_archive doesn't support PathLike

2017-04-30 Thread Jelle Zijlstra

New submission from Jelle Zijlstra:

According to PEP 519, it should. I'll submit a PR soon.

--
components: Library (Lib)
messages: 292642
nosy: Jelle Zijlstra, brett.cannon, tarek
priority: normal
severity: normal
status: open
title: shutil.unpack_archive doesn't support PathLike
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue28556] typing.py upgrades

2017-04-30 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi :


--
pull_requests: +1475

___
Python tracker 

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



[issue30217] Missing entry for the tilde (~) operator in the Index

2017-04-30 Thread Eric O. LEBIGOT

New submission from Eric O. LEBIGOT:

The index (https://docs.python.org/3.6/genindex-Symbols.html) is missing an 
entry for the tilde operator ~ (there is also no entry under "tilde").

A relevant pointer could be to object.__invert__ 
(https://docs.python.org/3.6/reference/datamodel.html#object.__invert__).

--
assignee: docs@python
components: Documentation
messages: 292641
nosy: docs@python, lebigot
priority: normal
severity: normal
status: open
title: Missing entry for the tilde (~) operator in the Index
type: enhancement
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



Re: test_imaplib fail when installing python3.6.1 on centos6.9

2017-04-30 Thread Terry Reedy

On 4/30/2017 9:09 AM, Wade Wang wrote:

Hello, everyone. I'm trying to install Python 3.6.1 on my CentOS 6.9
server, but test_imaplib always fails its test when make test. Here is what
I got:


==
ERROR: test_logincapa_with_client_certfile (test.test_imaplib.RemoteIMAP_

SSLTest)

--
Traceback (most recent call last):
   File "/root/Python-3.6.1/Lib/test/test_imaplib.py", line 973, in

test_logincapa_with_client_certfile

 certfile=CERTFILE)
   File "/root/Python-3.6.1/Lib/imaplib.py", line 1280, in __init__
 IMAP4.__init__(self, host, port)
   File "/root/Python-3.6.1/Lib/imaplib.py", line 197, in __init__
 self.open(host, port)
   File "/root/Python-3.6.1/Lib/imaplib.py", line 1293, in open
 IMAP4.open(self, host, port)
   File "/root/Python-3.6.1/Lib/imaplib.py", line 294, in open
 self.sock = self._create_socket()
   File "/root/Python-3.6.1/Lib/imaplib.py", line 1285, in _create_socket
 server_hostname=self.host)
   File "/root/Python-3.6.1/Lib/ssl.py", line 401, in wrap_socket
 _context=self, _session=session)
   File "/root/Python-3.6.1/Lib/ssl.py", line 808, in __init__
 self.do_handshake()
   File "/root/Python-3.6.1/Lib/ssl.py", line 1061, in do_handshake
 self._sslobj.do_handshake()
   File "/root/Python-3.6.1/Lib/ssl.py", line 683, in do_handshake
 self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca

(_ssl.c:749)


==
ERROR: test_logincapa_with_client_ssl_context

(test.test_imaplib.RemoteIMAP_SSLTest)

--
Traceback (most recent call last):
   File "/root/Python-3.6.1/Lib/test/test_imaplib.py", line 979, in
test_logincapa_with_client_ssl_context
 self.host, self.port, ssl_context=self.create_ssl_context())
   File "/root/Python-3.6.1/Lib/imaplib.py", line 1280, in __init__
 IMAP4.__init__(self, host, port)
   File "/root/Python-3.6.1/Lib/imaplib.py", line 197, in __init__
 self.open(host, port)
   File "/root/Python-3.6.1/Lib/imaplib.py", line 1293, in open
 IMAP4.open(self, host, port)
   File "/root/Python-3.6.1/Lib/imaplib.py", line 294, in open
 self.sock = self._create_socket()
   File "/root/Python-3.6.1/Lib/imaplib.py", line 1285, in _create_socket
 server_hostname=self.host)
   File "/root/Python-3.6.1/Lib/ssl.py", line 401, in wrap_socket
 _context=self, _session=session)
   File "/root/Python-3.6.1/Lib/ssl.py", line 808, in __init__
 self.do_handshake()
   File "/root/Python-3.6.1/Lib/ssl.py", line 1061, in do_handshake
 self._sslobj.do_handshake()
   File "/root/Python-3.6.1/Lib/ssl.py", line 683, in do_handshake
 self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca

(_ssl.c:749)


--
Ran 95 tests in 27.005s

FAILED (errors=2)
1 test failed again:
 test_imaplib

Total duration: 6 min 34 sec
Tests result: FAILURE
make: *** [test] Error 1


Any solution or suggestion?


Unless you get a better solution here, open an issue on bugs.python.org. 
 In the Nosy list box, enter 'ssl' and click the list under 'module'.



--
Terry Jan Reedy

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


[issue30200] tkinter ListboxSelect

2017-04-30 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Frank, bigger is not better for demonstrating a problem.  The only thing needed 
for this issue is a tk window with two list boxes.  Having to click twice to 
get a window with more than just the two Listboxes is just noise.  

Anyway, I downloaded the file as tem.py into a directory on the path and ran 
"py -x.y -m tem" with the 3 x,y pairs.  For 3.6 I see the traceback Louie Lu 
posted -- **for 2.7**.

Since clicking in box 2 after clicking in box 1 changes the selection set in 
*both* boxes, on all 3 versions, there should a <> event for 
both, on all 3 versions, as specified in the tcl/tk doc that I quoted. I 
believe it was a bug when the deselect event did not happen.

On Windows, 2.7.13 uses tk 8.5.15, 3.5.z uses tk 8.6.4, and 3.6.z uses tk 
8.6.6.  My hypothesis is that the bug of not raising an event for the deselect, 
at least on Windows, was fixed in tk in 8.6.5/6.  If so, this should be closed 
as 'not a bug'.

Louie, what tk x.y.z do you have on your linux?

Serhiy, did you change anything in tkinter for 8.6 that could have affected 
<> events?

--

___
Python tracker 

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



[issue30195] writing non-ascii characters in xml file using python code embedded in C

2017-04-30 Thread mahboubi

mahboubi added the comment:

Probably it's my fault to use the word 'crash', what I mean is that generated 
report by python program contains the right result(the 'alerte' balise is 
added) but the other report generated by the same python program embedde in C 
didn't give the right result (report is created but no 'alerte' balise is added)

--

___
Python tracker 

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



[issue30145] Create a How to or Tutorial documentation for asyncio

2017-04-30 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

I think it will still be useful to have an authoritative tutorial within 
CPython docs.

--

___
Python tracker 

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



[issue20401] inspect.signature removes initial starred method params (bug)

2017-04-30 Thread Louie Lu

Louie Lu added the comment:

Is there any reason that the second case Terry provide still will failed with 
ValueError?

class C:
def meth2(**kwds): pass


ip.signature(C().meth2)

Traceback (most recent call last):
  File "/home/linux/Python/cpython/Lib/idlelib/idle_test/test_calltips.py", 
line 139, in test_starred_parameter
self.assertEqual(signature(meth), mtip)
  File "/home/linux/Python/cpython/Lib/idlelib/calltips.py", line 149, in 
get_argspec
argspec = str(inspect.signature(fob))
  File "/home/linux/Python/cpython/Lib/inspect.py", line 3028, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  File "/home/linux/Python/cpython/Lib/inspect.py", line 2778, in from_callable
follow_wrapper_chains=follow_wrapped)
  File "/home/linux/Python/cpython/Lib/inspect.py", line 2195, in 
_signature_from_callable
return _signature_bound_method(sig)
  File "/home/linux/Python/cpython/Lib/inspect.py", line 1785, in 
_signature_bound_method
raise ValueError('invalid method signature')
ValueError: invalid method signature

--
nosy: +louielu

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2017-04-30 Thread Louie Lu

Louie Lu added the comment:

I'm now testing to change getfullargspect to signature. It came out that 
signature can't accept bound method with only _VAR_KEYWORD. This test case will 
gave a ValueError:

>>> class C:
def m2(**kw):
pass
>>> c = C()
>>> ip.signature(c.m2)
   Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/inspect.py", line 3002, in signature
return Signature.from_callable(obj, follow_wrapped=follow_wrapped)
  File "/usr/lib/python3.6/inspect.py", line 2752, in from_callable
follow_wrapper_chains=follow_wrapped)
  File "/usr/lib/python3.6/inspect.py", line 2169, in _signature_from_callable
return _signature_bound_method(sig)
  File "/usr/lib/python3.6/inspect.py", line 1759, in _signature_bound_method
raise ValueError('invalid method signature')
ValueError: invalid method signature

--
nosy: +louielu

___
Python tracker 

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



[issue30216] xdrlib.Unpacker.unpack_string returns bytes (docs say should be str)

2017-04-30 Thread Xiang Zhang

Changes by Xiang Zhang :


--
stage:  -> needs patch
versions: +Python 3.5, Python 3.7

___
Python tracker 

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



[issue30216] xdrlib.Unpacker.unpack_string returns bytes (docs say should be str)

2017-04-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The term "string" in names like "pack_string" refers to the XDR standard (RFC 
1014). They have to stay, but the documentation must be updated to make clear 
that they work with bytes.

--

___
Python tracker 

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



[issue30195] writing non-ascii characters in xml file using python code embedded in C

2017-04-30 Thread mahboubi

mahboubi added the comment:

Also, using codecs.open(encoding='utf8') gives unhadled exception in C? but no 
problem using python code only.

--

___
Python tracker 

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



[issue26143] Ensure that IDLE's stdlib imports are from the stdlib

2017-04-30 Thread Louie Lu

Louie Lu added the comment:

Because sys module is correctly imported, we can modify sys.path to change the 
import behave.

Add new PR 1364 for this.

This add a new private function `_fix_import_path` that will remove the local 
import path `''`, when running IDLE from command line, it will recover the 
import path at the end of the argparse part. So no need to worry about user to 
import other local modules.

That also mean, if our user has the same name file, they will not be able to 
import it anymore. (cause IDLE import it first).

--
nosy: +louielu

___
Python tracker 

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



[issue30195] writing non-ascii characters in xml file using python code embedded in C

2017-04-30 Thread Xiang Zhang

Xiang Zhang added the comment:

But I didn't see any crash either. You'd better provide a simple reproduce 
program, not involving so much logic. Or could you debug it and provide a crash 
backtrace?

--

___
Python tracker 

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



[issue30195] writing non-ascii characters in xml file using python code embedded in C

2017-04-30 Thread mahboubi

mahboubi added the comment:

Thank you xiang zhang for your reply.
I think that the problem is not in xml_file.write(doc.toprettyxml()) because it 
works using python only, and the C problem dosen't work since you didn't get 
any 'alerte' balise.

--
status: pending -> open

___
Python tracker 

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



[issue26143] Ensure that IDLE's stdlib imports are from the stdlib

2017-04-30 Thread Louie Lu

Changes by Louie Lu :


--
pull_requests: +1474

___
Python tracker 

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



test_imaplib fail when installing python3.6.1 on centos6.9

2017-04-30 Thread Wade Wang
Hello, everyone. I'm trying to install Python 3.6.1 on my CentOS 6.9
server, but test_imaplib always fails its test when make test. Here is what
I got:

> ==
> ERROR: test_logincapa_with_client_certfile (test.test_imaplib.RemoteIMAP_
SSLTest)
> --
> Traceback (most recent call last):
>   File "/root/Python-3.6.1/Lib/test/test_imaplib.py", line 973, in
test_logincapa_with_client_certfile
> certfile=CERTFILE)
>   File "/root/Python-3.6.1/Lib/imaplib.py", line 1280, in __init__
> IMAP4.__init__(self, host, port)
>   File "/root/Python-3.6.1/Lib/imaplib.py", line 197, in __init__
> self.open(host, port)
>   File "/root/Python-3.6.1/Lib/imaplib.py", line 1293, in open
> IMAP4.open(self, host, port)
>   File "/root/Python-3.6.1/Lib/imaplib.py", line 294, in open
> self.sock = self._create_socket()
>   File "/root/Python-3.6.1/Lib/imaplib.py", line 1285, in _create_socket
> server_hostname=self.host)
>   File "/root/Python-3.6.1/Lib/ssl.py", line 401, in wrap_socket
> _context=self, _session=session)
>   File "/root/Python-3.6.1/Lib/ssl.py", line 808, in __init__
> self.do_handshake()
>   File "/root/Python-3.6.1/Lib/ssl.py", line 1061, in do_handshake
> self._sslobj.do_handshake()
>   File "/root/Python-3.6.1/Lib/ssl.py", line 683, in do_handshake
> self._sslobj.do_handshake()
> ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca
(_ssl.c:749)
>
> ==
> ERROR: test_logincapa_with_client_ssl_context
(test.test_imaplib.RemoteIMAP_SSLTest)
> --
> Traceback (most recent call last):
>   File "/root/Python-3.6.1/Lib/test/test_imaplib.py", line 979, in
> test_logincapa_with_client_ssl_context
> self.host, self.port, ssl_context=self.create_ssl_context())
>   File "/root/Python-3.6.1/Lib/imaplib.py", line 1280, in __init__
> IMAP4.__init__(self, host, port)
>   File "/root/Python-3.6.1/Lib/imaplib.py", line 197, in __init__
> self.open(host, port)
>   File "/root/Python-3.6.1/Lib/imaplib.py", line 1293, in open
> IMAP4.open(self, host, port)
>   File "/root/Python-3.6.1/Lib/imaplib.py", line 294, in open
> self.sock = self._create_socket()
>   File "/root/Python-3.6.1/Lib/imaplib.py", line 1285, in _create_socket
> server_hostname=self.host)
>   File "/root/Python-3.6.1/Lib/ssl.py", line 401, in wrap_socket
> _context=self, _session=session)
>   File "/root/Python-3.6.1/Lib/ssl.py", line 808, in __init__
> self.do_handshake()
>   File "/root/Python-3.6.1/Lib/ssl.py", line 1061, in do_handshake
> self._sslobj.do_handshake()
>   File "/root/Python-3.6.1/Lib/ssl.py", line 683, in do_handshake
> self._sslobj.do_handshake()
> ssl.SSLError: [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca
(_ssl.c:749)
>
> --
> Ran 95 tests in 27.005s
>
> FAILED (errors=2)
> 1 test failed again:
> test_imaplib
>
> Total duration: 6 min 34 sec
> Tests result: FAILURE
> make: *** [test] Error 1

Any solution or suggestion?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue30195] writing non-ascii characters in xml file using python code embedded in C

2017-04-30 Thread Xiang Zhang

Xiang Zhang added the comment:

IMHO this doesn't look like an error in xml library. With a little tweak in of 
your problem: adding encoding declaration, removing not needed imports, replace 
open with codecs.open(encoding='utf8') in create_report, the C problem works 
fine for me:

[tmp]$ cat essai_rapport_test_30-04-2017-22-22_你好.xml



xml_file.write(doc.toprettyxml()) fails for me since ascii codecs cannot encode 
the result of doc.toprettyxml, a unicode. And I would suggest you adding 
failure checks to your C program. Almost every step could fail and then result 
in a segfault.

--
nosy: +xiang.zhang
status: open -> pending

___
Python tracker 

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



[issue30216] xdrlib.Unpacker.unpack_string returns bytes (docs say should be str)

2017-04-30 Thread Xiang Zhang

Xiang Zhang added the comment:

xdrlib doc seems still remain in 2.x world. 'string' is used to represent 
'bytes'. And some methods' names like pack_fstring, pack_string seem not 
suitable in 3.x world.

--
nosy: +haypo, serhiy.storchaka, xiang.zhang

___
Python tracker 

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



Re: tempname.mktemp functionality deprecation

2017-04-30 Thread Tim Chase
On 2017-04-29 20:51, Devin Jeanpierre wrote:
> On Sat, Apr 29, 2017 at 11:45 AM, Tim Chase wrote
> > So which route should I pursue?
> >
> > - go ahead and use tempfile.mktemp() ignoring the deprecation?
> >
> > - use a GUID-named temp-file instead for less chance of collision?
> >
> > - I happen to already have a hash of the file contents, so use
> >   the .hexdigest() string as the temp-file name?
> >
> > - some other solution I've missed?
> 
> I vote the last one: you can read the .name attribute of the
> returned file(-like) object from NamedTemporaryFile to get a path
> to a file, which can be passed to other functions.

Unfortunately, his entails the file-preexisting, causing the same
EEXISTS problem as before:

  $ cd ~/tmp
  $ echo hello > a
  $ python
  ...
  >>> from tempfile import NamedTemporaryFile as NTF
  >>> f = NTF(dir='.')
  >>> import os
  >>> os.link('a', f.name)
  Traceback (most recent call last):
File "", line 1, in 
  OSError: [Errno 17] File exists
  >>> f.name
  '/home/tim/tmp/tmpokEpht'

-tkc


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


[issue26253] tarfile in stream mode always set zlib compression level to 9

2017-04-30 Thread Xiang Zhang

Xiang Zhang added the comment:

*compresslevel* takes effect for modes 'w:gz', 'r:gz', 'w:bz2', 'r:bz2', 
'x:gz', 'x:bz2'. For stream modes, 'r|gz', 'w|gz', 'r|bz2', 'w|bz2', the 
*compresslevel* doesn't make sense. It seems not hard to make it possible but 
I'm not sure it's worth it or there is any reason it's hard-coded.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue29700] readline memory corruption when sys.stdin fd >= FD_SETSIZE for select()

2017-04-30 Thread Marien Zwart

Marien Zwart added the comment:

GNU readline 7.0 introduces the problematic use of pselect(). GNU readline 6.3 
is unaffected (and presumably older versions as well). I didn't check other 
implementations.

I'll see if I can get this fixed in GNU readline. The non-select code is still 
there, and the NEWS file says pselect is used because SIGWINCH interrupts it, 
while it doesn't interrupt read(). So maybe readline can fall through to the 
old code if a high FD is used, since it doesn't regress functionality that much 
(while adding poll support to readline would run into similar portability 
issues as we're seeing here).

--

___
Python tracker 

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



[issue30145] Create a How to or Tutorial documentation for asyncio

2017-04-30 Thread Martin Panter

Martin Panter added the comment:

See Issue 27579, where Victor wanted to focus on 
 outside of Python.

--
nosy: +haypo, martin.panter

___
Python tracker 

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



[issue15346] Tkinter extention modules have no documentation

2017-04-30 Thread Martin Panter

Changes by Martin Panter :


--
dependencies: +No Documentation on tkinter dnd module

___
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

2017-04-30 Thread Masayuki Yamamoto

Masayuki Yamamoto added the comment:

Victor,
The tracemalloc module is not available on platforms that provides own TLS 
implementation that uses PyMem_* functions.  In the own implementation, it 
occurs deadlock by recursion call in thread key search.  PyOnceVar API handles 
extendable array by using PyMem_Reallloc, therefore, I think TSS key 
initialization using the API will raise deadlock likewise.

--

___
Python tracker 

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



[issue30213] ZipFile from 'a'ppend-mode file generates invalid zip

2017-04-30 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue30210] No Documentation on tkinter dnd module

2017-04-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
stage:  -> needs patch

___
Python tracker 

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



[issue30212] test_ssl.py is broken in Centos7

2017-04-30 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +haypo, xiang.zhang

___
Python tracker 

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



[issue30211] Bdb: add docstrings

2017-04-30 Thread Cheryl Sabella

Changes by Cheryl Sabella :


--
components: +Documentation -IDLE

___
Python tracker 

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



[issue30211] Bdb: add docstrings

2017-04-30 Thread Cheryl Sabella

Changes by Cheryl Sabella :


--
components: +IDLE -Documentation

___
Python tracker 

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



[issue30210] No Documentation on tkinter dnd module

2017-04-30 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +gpolo, serhiy.storchaka

___
Python tracker 

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



[issue30216] xdrlib.Unpacker.unpack_string returns bytes (docs say should be str)

2017-04-30 Thread Rupert Nash

New submission from Rupert Nash:

According to the docs this method should return a str, but it returns bytes
https://docs.python.org/3.6/library/xdrlib.html#xdrlib.Unpacker.unpack_string

I can see three options:
 a default encoding should be applied
 the documentation updated to make clear this returns bytes
 the method removed and just rely on the existing unpack_bytes which does what 
you'd expect (and in fact the two methods are aliases)

--
components: Library (Lib)
messages: 292624
nosy: rnash
priority: normal
severity: normal
status: open
title: xdrlib.Unpacker.unpack_string returns bytes (docs say should be str)
type: behavior
versions: Python 3.6

___
Python tracker 

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



Re: Rosetta: Count in factors

2017-04-30 Thread alister
On Sat, 29 Apr 2017 22:05:16 +, Robert L. wrote:

>> Task
>> 
>> Write a program which counts up from 1, displaying each number as the
>> multiplication of its prime factors.
>> 
>> For the purpose of this task, 1 (unity) may be shown as itself.
>> 
>> 
>> Example
>> 
>>2   is prime,   so it would be shown as itself. 6   is not prime;  
>>it would be shown as   2 x 3
>> 2144   is not prime;   it would be shown as   2 x 2 x 2 x 2 x 2 x 67
> 
> 
> require 'prime'
> 
> puts " 1: 1" ; (2..23).each{|n|
>   printf "%2d: %s\n", n,
> Prime.prime_division(n).map{|f,c| ([f]*c).join ' x '}.join(' x ')
> }
> 
>  1: 1 2: 2 3: 3 4: 2 x 2 5: 5 6: 2 x 3 7: 7 8: 2 x 2 x 2 9: 3 x 3
> 10: 2 x 5 11: 11 12: 2 x 2 x 3 13: 13 14: 2 x 7 15: 3 x 5 16: 2 x 2 x 2
> x 2 17: 17 18: 2 x 3 x 3 19: 19 20: 2 x 2 x 5 21: 3 x 7 22: 2 x 11 23:
> 23

It does not help a student if you do their homework for them,

much better to provide hints & guidance



-- 
Why do mathematicians insist on using words that already have another
meaning?  "It is the complex case that is easier to deal with."  "If it
doesn't happen at a corner, but at an edge, it nonetheless happens at a
corner."
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue29136] Add OP_NO_TLSv1_3

2017-04-30 Thread Christian Heimes

Changes by Christian Heimes :


--
pull_requests: +1473

___
Python tracker 

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



[issue30177] pathlib.resolve(strict=False) only includes first child

2017-04-30 Thread Antoine Pietri

Antoine Pietri added the comment:

I can reproduce this bug. This behavior is really confusing.

--
nosy: +seirl

___
Python tracker 

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



[issue30208] Small typos in IDLE doc

2017-04-30 Thread Cheryl Sabella

Cheryl Sabella added the comment:

LOL, well I made that a lot harder than you intended.  :-)

--
components:  -Documentation

___
Python tracker 

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



[issue19417] Bdb: add a unittest file (test.test_bdb)

2017-04-30 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Thanks Terry and Cheryl for splitting the issue :)

--

___
Python tracker 

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



[issue30207] Rename test.test_support to test.support in 2.7

2017-04-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue30207] Rename test.test_support to test.support in 2.7

2017-04-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset a694e092f6356970ca0d3e86000a3a829fb212b4 by Serhiy Storchaka in 
branch '2.7':
bpo-30207: Rename test.test_support to test.support. (#1353)
https://github.com/python/cpython/commit/a694e092f6356970ca0d3e86000a3a829fb212b4


--

___
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

2017-04-30 Thread Masayuki Yamamoto

Changes by Masayuki Yamamoto :


--
pull_requests: +1472

___
Python tracker 

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



Re: Not understanding itertools.dropwhile()

2017-04-30 Thread Peter Otten
Jason Friedman wrote:

> def test_to_start(s):
> return "2" in s
> 
> for line in itertools.dropwhile(test_to_start, data.splitlines()):
> print(line)

It's really all in the names: it could either be

for line in dropwhile(test_to_drop, items):
...

or

for line in dropwhilenot(test_to_start, items):
...
 
> < end code >
> 
> I expect:
> 
> $ python3 dropwhile.py
> Line2
> 
> Line4
> Line5
> 
> 
> I get:
> 
> $ python3 dropwhile.py
> Line1
> Line2
> 
> Line4
> Line5
> 
> 
> Please explain.


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


Re: Inconsistency between dict() and collections.OrderedDict() methods.

2017-04-30 Thread Gregory Ewing

Erik wrote:
Is there not a class that is somewhere between "dict" and "OrderedDict" 
that provides what I need?


Such a class could exist, but the stdlib doesn't happen to provide
one as far as I know.

Note, though, that you're relying on implementation details of
OrderedDict when you use it to "fix" your problem in this way.
It happens to work in some versions of Python, but it might not
work in the next one.

> OK, so technically it is a subclass, I didn't notice that, but where
> does the documentation explain all of the differences in behaviour?

It doesn't, but the differences you're talking about are differences
between undocumented behavour of dict and undocumented behaviour
of OrderedDict. The docs are under no obligation to tell you about any
of that.

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


Re: tempname.mktemp functionality deprecation

2017-04-30 Thread Gregory Ewing

Devin Jeanpierre wrote:

I vote the last one: you can read the .name attribute of the returned
file(-like) object from NamedTemporaryFile to get a path to a file,
which can be passed to other functions.


I don't think that helps. You would have to delete the file
first before you could create a link with that name, and that
would leave a window of opportunity for another process to
create something with the same name.

I would generate a name that's likely to be unique (using
mktemp() or otherwise) and try to create a link with that name.
If it fails because the name is in use, generate another name
and try again.

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