[issue37846] declare that Text I/O use buffer inside

2019-08-13 Thread Windson Yang


New submission from Windson Yang :

At the beginning of https://docs.python.org/3.7/library/io.html#io.RawIOBase, 
we declared that 

> Binary I/O (also called buffered I/O)
and 
> Raw I/O (also called unbuffered I/O)

But we didn't mention if Text I/O use buffer or not which led to confusion. 
Even though we talked about it later in 
https://docs.python.org/3.7/library/io.html#class-hierarchy

> The TextIOBase ABC, another subclass of IOBase, deals with streams whose 
> bytes represent text, and handles encoding and decoding to and from strings. 
> TextIOWrapper, which extends it, is a buffered text interface to a buffered 
> raw stream (BufferedIOBase). Finally, StringIO is an in-memory stream for 
> text.

IMO, it will be better to declare 'Reads and writes are internally buffered in 
order to speed things up' at the very beginning in 

> Text I/O
> Text I/O expects and produces str objects...

or maybe

> class io.TextIOBase
> Base class for text streams. This class provides a character and line based 
> interface to stream I/O. It inherits IOBase. There is no public constructor.

--
assignee: docs@python
components: Documentation
messages: 349633
nosy: Windson Yang, docs@python
priority: normal
severity: normal
status: open
title: declare that Text I/O use buffer inside
type: enhancement
versions: Python 3.8

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



[issue37846] declare that Text I/O use buffer inside

2019-08-13 Thread Windson Yang


Windson Yang  added the comment:

I found the document is not that clear when I try to understand what happens 
when Python read/write a file. I'm not sure who also needs this information. As 
you said, It wouldn't help the user program in Python. However, make it more 
clear maybe help users have a better feeling of what is happening under the 
hood.

--

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



[issue38125] Can' build document in Sphinx v2.2.0

2019-09-11 Thread Windson Yang


New submission from Windson Yang :

I got two errors when I try to build python document with

make venv
make html

The first one is 

> Since v2.0, Sphinx uses "index" as master_doc by default. Please add 
> "master_doc = 'contents'" to your conf.py.

After fixing this one, the second one is 

> /Users/windson/learn/cpython/Doc/library/email.message.rst:4:duplicate object 
> description of email.message, other instance in 
> library/email.compat32-message, use :noindex: for one of them

--
assignee: docs@python
components: Documentation
messages: 352034
nosy: Windson Yang, docs@python
priority: normal
severity: normal
status: open
title: Can' build document in Sphinx v2.2.0
type: crash
versions: Python 3.9

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



[issue38125] Can' build document in Sphinx v2.2.0

2019-10-28 Thread Windson Yang


Change by Windson Yang :


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

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



[issue38626] small change at bisect_left function for easy understanding

2019-10-28 Thread Windson Yang


New submission from Windson Yang :

bisect_left should be similar to bisect_right. However, the current implement 
didn't reflect it. A little bit update for the bisect_left function could make 
the user easy to understand their relation.

def bisect_left(a, x, lo=0, hi=None):
if lo < 0:
raise ValueError('lo must be non-negative')
if hi is None:
hi = len(a)
while lo < hi:
mid = (lo+hi)//2
# <= should be the only difference between bisect_left and bisect_right
if x <= a[mid]: hi = mid
else: lo = mid+1
return lo

--
components: Library (Lib)
messages: 355606
nosy: Windson Yang
priority: normal
severity: normal
status: open
title: small change at bisect_left function for easy understanding
versions: Python 3.8

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



[issue36093] UnicodeEncodeError raise from smtplib.verify() method

2020-03-27 Thread Windson Yang


Windson Yang  added the comment:

Any update?

--

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



[issue36453] pkgutil.get_importer only return the first valid path_hook(importer)

2020-03-27 Thread Windson Yang


Windson Yang  added the comment:

Any update?

--

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



[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode

2019-05-23 Thread Windson Yang


Windson Yang  added the comment:

I'm not sure it's a bug. When you write binary data to file (use BufferedIOBase 
by default). It actually writes the data to a buffer. That is why tell() gets 
out of sync. You can follow the instrument belolw. For instance, call flush() 
after writing to get the `correct answer.`

> When writing to this object, data is normally placed into an internal buffer. 
> The buffer will be written out to the underlying RawIOBase object under 
> various conditions, including:

> when the buffer gets too small for all pending data;
> when flush() is called;
> when a seek() is requested (for BufferedRandom objects);
> when the BufferedWriter object is closed or destroyed.

1. https://docs.python.org/3/library/io.html#io.BufferedWriter

--

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



[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode

2019-05-23 Thread Windson Yang


Windson Yang  added the comment:

I think we should mention it at the document, like in the tell() function.

--

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



[issue37073] clarify functions docs in IO modules and Bytes Objects

2019-05-28 Thread Windson Yang


New submission from Windson Yang :

> PyBytes_FromStringAndSize(const char *v, Py_ssize_t len): 
> Return a new bytes object with a copy of the string v as value and length len 
> on success, and NULL on failure. If v is NULL, the contents of the bytes 
> object are uninitialized.

The function actually copies `len` bytes from string v instead of the whole 
string. (link 1) I suggested we can change to 

> Return a new bytes object with a copy of the first len bytes of string v as 
> value and length len on success...

> readinto(b)
> Read bytes into a pre-allocated, writable bytes-like object b and return the 
> number of bytes read. For example, b might be a bytearray.

The function will call _bufferediobase_readinto_generic(link 2) which may 
return NULL. Maybe we can change to 

> and return the number of bytes that read succeed (it may be smaller than b or 
> NULL if failed)...

1. https://github.com/python/cpython/blob/master/Objects/bytesobject.c#L126

2. https://github.com/python/cpython/blob/master/Modules/_io/bufferedio.c#L962

--
assignee: docs@python
components: Documentation
messages: 343741
nosy: Windson Yang, docs@python
priority: normal
severity: normal
status: open
title: clarify functions docs in IO modules and Bytes Objects
type: enhancement
versions: Python 3.8

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



[issue37073] clarify functions docs in IO modules and Bytes Objects

2019-05-31 Thread Windson Yang


Windson Yang  added the comment:

Sure. Feel free to edit my PR.

--

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



[issue37073] clarify functions docs in IO modules and Bytes Objects

2019-05-31 Thread Windson Yang


Change by Windson Yang :


--
keywords: +patch
pull_requests: +13600
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/13713

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



[issue37073] clarify functions docs in IO modules and Bytes Objects

2019-05-31 Thread Windson Yang


Change by Windson Yang :


--
pull_requests: +13602
pull_request: https://github.com/python/cpython/pull/13715

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



[issue26468] shutil.copy2 raises OSError if filesystem doesn't support chmod

2019-06-02 Thread Windson Yang


Change by Windson Yang :


--
keywords: +patch
pull_requests: +13651
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/13765

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



[issue37086] time.sleep error message misleading

2019-06-02 Thread Windson Yang


Windson Yang  added the comment:

I just create a PR for it.

--
nosy: +Windson Yang

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



[issue37086] time.sleep error message misleading

2019-06-02 Thread Windson Yang


Change by Windson Yang :


--
keywords: +patch
pull_requests: +13652
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/13768

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



[issue15474] Differentiate decorator and decorator factory in docs

2019-06-03 Thread Windson Yang

Windson Yang  added the comment:

Hi, Andrés Delfino. Are you still working on it?

--
nosy: +Windson Yang

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



[issue29750] smtplib doesn't handle unicode passwords

2019-07-31 Thread Windson Yang


Windson Yang  added the comment:

Sorry, I forgot about this PR, I will update the patch depends on review soon :D

--

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



[issue29750] smtplib doesn't handle unicode passwords

2019-07-31 Thread Windson Yang


Change by Windson Yang :


--
pull_requests: +14813
pull_request: https://github.com/python/cpython/pull/15064

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



[issue29750] smtplib doesn't handle unicode passwords

2019-07-31 Thread Windson Yang


Windson Yang  added the comment:

I just updated the PR

--

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



[issue35251] FTPHandler.ftp_open documentation error

2018-11-19 Thread Windson Yang


Change by Windson Yang :


--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python

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



[issue35273] 'eval' in generator expression behave different in dict from list

2018-11-19 Thread Windson Yang


Windson Yang  added the comment:

I get NameError for both versions in both 3.4.4, 3.5.2, 3.6.4, 3.7.1

--
nosy: +Windson Yang

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



[issue35131] Cannot access to customized paths within .pth file

2018-11-21 Thread Windson Yang


Windson Yang  added the comment:

I will fix this issue after we have consensus with the future of .pth file in 
#33944

--

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



[issue35267] reproducible deadlock with multiprocessing.Pool

2018-11-21 Thread Windson Yang


Windson Yang  added the comment:

I will work on it if no one wants to create a PR for this next week.

--

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



[issue35348] Problems with handling the file command output in platform.architecture()

2018-11-29 Thread Windson Yang


Windson Yang  added the comment:

I agreed with Serhiy. I also found the function decode the output with latin-1, 
I think it will be better to use utf-8 instead.

--
nosy: +Windson Yang

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



[issue35325] imp.find_module() return value documentation discrepancy

2018-11-29 Thread Windson Yang


Windson Yang  added the comment:

If I understand correctly, this may be better.

Try to find the module name. If path is omitted or None, the list of directory 
names given by sys.path is searched. If path is built-in or frozen modules, 
return None instead.

BTW, the dosstring should also be updated, I will not continue search the path 
if the path in build-in or frozen. and this module is deprecated since version 
3.4

--
nosy: +Windson Yang
versions: +Python 3.4, Python 3.5, Python 3.6

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



[issue35324] ssl: FileNotFoundError when do handshake

2018-12-07 Thread Windson Yang


Windson Yang  added the comment:

I can't reproduce on my laptop. Would you please upload a minimal example?

--
nosy: +Windson Yang

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



[issue35267] reproducible deadlock with multiprocessing.Pool

2018-12-08 Thread Windson Yang


Windson Yang  added the comment:

As Jonathan Gossage said, I think it may break some code to fix this issue, 
maybe we could just add a warning on the document?

--

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



[issue35325] imp.find_module() return value documentation discrepancy

2018-12-08 Thread Windson Yang


Change by Windson Yang :


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

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



[issue35105] Document that CPython accepts "invalid" identifiers

2018-12-08 Thread Windson Yang


Windson Yang  added the comment:

Any ideas? Or I will create a PR in a week without 'CPython implementation 
detail'

--

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



[issue35367] FileExistsError During os.symlink() Displays Arrow in the Wrong Direction

2018-12-13 Thread Windson Yang


Change by Windson Yang :


--
pull_requests: +10373

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



[issue35267] reproducible deadlock with multiprocessing.Pool

2018-12-13 Thread Windson Yang


Change by Windson Yang :


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

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



[issue35324] ssl: FileNotFoundError when do handshake

2018-12-20 Thread Windson Yang


Windson Yang  added the comment:

>From the docs

Changed in version 3.7: Hostname or IP address is matched by OpenSSL during 
handshake. The function match_hostname() is no longer used. In case OpenSSL 
refuses a hostname or IP address, the handshake is aborted early and a TLS 
alert message is send to the peer.

I guess OpenSSL refuse your IP address and port.

--

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



[issue35105] Document that CPython accepts "invalid" identifiers

2018-12-20 Thread Windson Yang


Change by Windson Yang :


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

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



[issue35105] Document that CPython accepts "invalid" identifiers

2019-01-04 Thread Windson Yang


Windson Yang  added the comment:

I agreed with @Raymond Hettinger, I will update the PR from your suggestion if 
no other ideas in next week.

--

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



[issue35325] imp.find_module() return value documentation discrepancy

2019-01-04 Thread Windson Yang


Windson Yang  added the comment:

> The documentation should state that "pathname" will be None (not the empty 
> string) for built-in and frozen modules in order to be in line with the 
> implementation.

Both the "file" and "pathname" will be None for built-in and frozen modules, 
right? In the PR @ericsnowcurrently suggested add:

>  If the module is built-in or frozen then *file* and *pathname* are both 
> ``None`` and the *description* tuple contains empty...

I think it also works.

--

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



[issue34628] urllib.request.urlopen fails when userinfo is present in URL

2019-01-10 Thread Windson Yang


Windson Yang  added the comment:

I found that Requests library use urllib3 library which looks like ignore the 
user info part (in request_context 
https://github.com/urllib3/urllib3/blob/master/src/urllib3/poolmanager.py#L208).
 Did I miss something or we should also ignore it?

--

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



[issue35745] Add import statement in dataclass code snippet

2019-01-15 Thread Windson Yang


New submission from Windson Yang :

Most of the example in https://docs.python.org/3/library/dataclasses.html miss 
code like

from dataclasses import dataclass, field
from typing import List

I think we should add this statement in the code snippet.

--
assignee: docs@python
components: Documentation
messages: 333707
nosy: Windson Yang, docs@python
priority: normal
severity: normal
status: open
title: Add import statement in dataclass code snippet
type: enhancement
versions: Python 3.7, Python 3.8

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



[issue35745] Add import statement in dataclass code snippet

2019-01-15 Thread Windson Yang


Windson Yang  added the comment:

I'm not sure if we should put 

from dataclasses import dataclass

everywhere or we should put it just in the first example as I did in the PR.

--

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



[issue34397] remove redundant overflow checks in tuple and list implementations

2019-01-24 Thread Windson Yang


Windson Yang  added the comment:

I reviewed the patch months ago, maybe we need a core developer review this 
path?

--

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



[issue34628] urllib.request.urlopen fails when userinfo is present in URL

2019-01-26 Thread Windson Yang


Windson Yang  added the comment:

Why requests library didn't raise an error because urllib3 (the library 
requests using) ignore the auth part right now

> Currently we expect our users to handle authentication headers themselves. 
> It's unfortunate that we silently strip this information though...

The discuss also in https://github.com/urllib3/urllib3/issues/1530

Should we ignore the userinfo part of raising an error here?

--

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



[issue35846] Incomplete documentation for re.sub

2019-01-31 Thread Windson Yang


Windson Yang  added the comment:

I wonder if possible that c not in ASCIILETTERS when we get KeyError?

if c in ASCIILETTERS:
raise s.error('bad escape %s' % this, len(this))

--
nosy: +Windson Yang

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



[issue35868] Support ALL_PROXY environment variable in urllib

2019-01-31 Thread Windson Yang


Windson Yang  added the comment:

This is not a bug, it would be better to submit your ideas to python-ideas 
mail-list

--
nosy: +Windson Yang

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



[issue35858] Consider adding the option of running shell/console commands inside the REPL

2019-01-31 Thread Windson Yang


Windson Yang  added the comment:

Hello, jcrmatos. Maybe you can submit your idea to python-ideas mail-list.

--
nosy: +Windson Yang

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



[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-02-16 Thread Windson Yang


Windson Yang  added the comment:

IMHO, we don't need to add the option. We can return the smallest value from 
the **table** instead of the code below.

if len(table) == 1:
return table[0][0]

[1] https://github.com/python/cpython/blob/master/Lib/statistics.py#L502

--
nosy: +Windson Yang

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



[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-02-16 Thread Windson Yang


Windson Yang  added the comment:

I only tested stats.mode() from scipy, data = 'BBAAC' should also return 'A'. 
But in your code **return return Counter(seq).most_common(1)[0][0]** will 
return B. Did I miss something?

--

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



[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-02-18 Thread Windson Yang


Windson Yang  added the comment:

I think right now we can 
> Change mode() to return the first tie instead of raising an exception.  This 
> is a behavior change but leaves you with the cleanest API going forward.

as well as 
> Add a Deprecation warning to the current behavior of mode() when it finds 
> multimodal data.  

In Python 3.9, we change the behavior.

--

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



[issue36047] socket file handle does not support stream write

2019-02-19 Thread Windson Yang


Windson Yang  added the comment:

>From the docs 
>https://docs.python.org/3/library/socket.html#socket.socket.makefile, the 
>default mode for makefile() is 'r' (only readable). In your example, just use 
>S = s.makefile(mode='w') instead.

--
nosy: +Windson Yang

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



[issue36049] No __repr__() for queue.PriorityQueue and queue.LifoQueue

2019-02-20 Thread Windson Yang

Windson Yang  added the comment:

Hello, Zahash Z. May I ask what is your expected behavior for the return value 
of __repr__() from PriorityQueue. I'm agreed with Stéphane Wirtel, I don't 
think returning all the items would be a good idea, maybe we can improve it in 
another way. For instance, return the first and last element as well as the 
length.

--
nosy: +Windson Yang

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



[issue36093] UnicodeEncodeError raise from smtplib.verify() method

2019-02-22 Thread Windson Yang

New submission from Windson Yang :

AFAIK, the email address should support non-ASCII character (from 
https://stackoverflow.com/questions/760150/can-an-email-address-contain-international-non-english-characters
 and SMTPUTF8 
 option from 
https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.sendmail)

>>> import smtplib
>>> s = smtplib.SMTP(host='smtp-mail.outlook.com', port=587)
>>> s.verify('你好@outlook.com')
Traceback (most recent call last):
  File "", line 1, in 
  File "/Users/windson/learn/cpython/Lib/smtplib.py", line 577, in verify
self.putcmd("vrfy", _addr_only(address))
  File "/Users/windson/learn/cpython/Lib/smtplib.py", line 367, in putcmd
self.send(str)
  File "/Users/windson/learn/cpython/Lib/smtplib.py", line 352, in send
s = s.encode(self.command_encoding)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 5-6: 
ordinal not in range(128)

I found this issue when I updating 
https://github.com/python/cpython/pull/8938/files

--
components: Unicode
messages: 336374
nosy: Windson Yang, ezio.melotti, vstinner
priority: normal
severity: normal
status: open
title: UnicodeEncodeError raise from smtplib.verify() method
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

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



[issue36093] UnicodeEncodeError raise from smtplib.verify() method

2019-02-23 Thread Windson Yang


Windson Yang  added the comment:

Btw, from the docs 
https://docs.python.org/3/library/smtplib.html#smtplib.SMTP.sendmail

> msg may be a string containing characters in the ASCII range, or a byte 
> string. A string is encoded to bytes using the ascii codec, and lone \r and 
> \n characters are converted to \r\n characters. A byte string is not modified.
 
So we can't send non-ASCII msg using send_mail(), is this expected behavior?

--

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



[issue36153] Freeze support documentation is misleading.

2019-02-28 Thread Windson Yang


Windson Yang  added the comment:

IIUC, your script (using Sklearn/tensorflow) will cause an infinite loop when 
building with pyinstaller. Would you mind upload an example script so I can try 
to reproduce it?

--
nosy: +Windson Yang

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



[issue29539] [smtplib] collect response data for all recipients

2019-02-28 Thread Windson Yang


Windson Yang  added the comment:

sls, are you working on this feature now?

--
nosy: +Windson Yang

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



[issue36203] PyWeakref_NewRef docs are misleading

2019-03-06 Thread Windson Yang


Windson Yang  added the comment:

Yes, Maxwell. I guess the docs are misleading, the code locate in 
https://github.com/python/cpython/blob/master/Objects/weakrefobject.c#L748

if (callback == Py_None)
callback = NULL;
if (callback == NULL)
/* return existing weak reference if it exists */
result = ref;
if (result != NULL)
Py_INCREF(result);
else {
...
}

However, I'm not sure we should fix the docs or the code here.

--
nosy: +Windson Yang

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



[issue36203] PyWeakref_NewRef docs are misleading

2019-03-07 Thread Windson Yang


Windson Yang  added the comment:

It looks to me the fix is easy, we just will return NULL and raise TypeError 
when the callback is not callable, None, or NULL. I'm not an expert in C, but I 
would love to create a PR for it if you don't have time.

--

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



[issue36230] Please sort assertSetEqual's output

2019-03-07 Thread Windson Yang


Windson Yang  added the comment:

Just to be clear, as Raymond said, when we have two non-sortable objects (for 
instance, two instances which their class didn't implement the __lt__ and 
__gt__ methods), we should compare their repr() without sort() like now.

--
nosy: +Windson Yang

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



[issue36230] Please sort assertSetEqual's output

2019-03-07 Thread Windson Yang


Change by Windson Yang :


--
versions: +Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7

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



[issue36230] Please sort assertSetEqual's output

2019-03-08 Thread Windson Yang


Windson Yang  added the comment:

My point is careful about the non-sortable object. My mistake, this should be 
an enhancement, not a bug.

--
versions:  -Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7

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



[issue36248] document about `or`, `and` operator.

2019-03-08 Thread Windson Yang


New submission from Windson Yang :

I think we should document the behavior as below, (maybe at 
https://docs.python.org/3/reference/expressions.html#operator-precedence)

>>> 1 or 0 and 3
1
>>> 0 or 1 and 3
3

Please correct me if we already document it.

--
assignee: docs@python
components: Documentation
messages: 337555
nosy: Windson Yang, docs@python
priority: normal
severity: normal
status: open
title: document about `or`, `and` operator.
type: enhancement
versions: Python 3.8

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



[issue36248] document about `or`, `and` operator.

2019-03-09 Thread Windson Yang


Windson Yang  added the comment:

Thank you Serhiy, we did document here: 

> The expression x and y first evaluates x; if x is false, its value is 
> returned; otherwise, y is evaluated and the resulting value is returned.

> The expression x or y first evaluates x; if x is true, its value is returned; 
> otherwise, y is evaluated and the resulting value is returned.

Sorry, Steven. I should make it clear. I think the output of the example(1, 3) 
depends on the input order of number(1 or 0, 0 or 1) is not an expected 
behavior to me. Maybe we can add an example/note in the document. 

"Sometimes this will cause unexpected behavior when you put `or` and `and` 
together..."

--

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



[issue36248] document about `or`, `and` operator.

2019-03-09 Thread Windson Yang


Windson Yang  added the comment:

SilentGhost, I think you give a great example to explain this behavior. If the 
behavior is obvious to you, we can close this issue.

--

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



[issue18697] Unify arguments names in Unicode object C API documentation

2019-03-09 Thread Windson Yang


Change by Windson Yang :


--
versions: +Python 2.7, Python 3.4, Python 3.5

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



[issue18697] Unify arguments names in Unicode object C API documentation

2019-03-09 Thread Windson Yang


Windson Yang  added the comment:

I agreed with @Matheus, it would be better than the current implementation

--
nosy: +Windson Yang
versions: +Python 3.6, Python 3.7 -Python 2.7, Python 3.4, Python 3.5

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



[issue18697] Unify arguments names in Unicode object C API documentation

2019-03-09 Thread Windson Yang


Change by Windson Yang :


--
versions:  -Python 2.7

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



[issue26018] documentation of ZipFile file name encoding

2019-03-09 Thread Windson Yang


Windson Yang  added the comment:

I can't find the Note in the current document

--
nosy: +Windson Yang
versions: +Python 3.4, Python 3.5 -Python 3.7, Python 3.8

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



[issue26018] documentation of ZipFile file name encoding

2019-03-09 Thread Windson Yang


Windson Yang  added the comment:

Please ignore the last message, the docs locate in 3.4 and 3.5

--

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



[issue14934] generator objects can clear their weakrefs before being resurrected

2019-03-16 Thread Windson Yang


Windson Yang  added the comment:

In the docs 
https://docs.python.org/3/extending/newtypes.html#weak-reference-support points 
out:

> /* Clear weakrefs first before calling any destructors */

So maybe we should also update the docs after fix this bug. Anyway, I will try 
to understand/fix this bug.

--
nosy: +Windson Yang
versions: +Python 3.6, Python 3.7

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



[issue14934] generator objects can clear their weakrefs before being resurrected

2019-03-20 Thread Windson Yang


Windson Yang  added the comment:

The fixed looks easy, we call `PyObject_CallFinalizerFromDealloc` before 
PyObject_ClearWeakRefs. But I can't come up with the use case for testing when 
generator resurrects from `PyObject_CallFinalizer`. Any ideas?

--

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



[issue14817] pkgutil.extend_path has no tests

2019-03-21 Thread Windson Yang


Windson Yang  added the comment:

I would like to work on this and make a PR.

--
nosy: +Windson Yang
type:  -> enhancement
versions: +Python 3.7, Python 3.8, Python 3.9

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



[issue36411] Python 3 f.tell() gets out of sync with file pointer in binary append+read mode

2019-03-24 Thread Windson Yang


Windson Yang  added the comment:

This looks interesting. Let me try to fix it.

--
nosy: +Windson Yang
versions: +Python 3.8, Python 3.9 -Python 3.6

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



[issue14817] pkgutil.extend_path has no tests

2019-03-26 Thread Windson Yang


Windson Yang  added the comment:

My base idea would be some unittests for the function like:

class ExtendPathBaseTests(unittest.TestCase):
def test_input_string(self):
path = 'path'
name = 'foo'
self.assertEqual('path', pkgutil.extend_path(path, name))

def test_parent_package_raise_key_error(self):
path = ['path']
# sys.modules['foo'] raise KeyError
name = 'foo.bar'
self.assertEqual(['path'], pkgutil.extend_path(path, name))

def test_parent_package_raise_attr_error(self):
path = ['path']
# datetime module don't have __path__ attr
name = 'datetime.date'
self.assertEqual(['path'], pkgutil.extend_path(path, name))

I would move forward if we agreed.

--

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



[issue36453] get_importer only return the first valid path_hook(importer)

2019-03-27 Thread Windson Yang


New submission from Windson Yang :

Is it an expected behavior the get_importer function only returns the first 
valid path_hook(importer) from sys.path_hooks?

def get_importer(path_item):
"""Retrieve a finder for the given path item

The returned finder is cached in sys.path_importer_cache
if it was newly created by a path hook.

The cache (or part of it) can be cleared manually if a
rescan of sys.path_hooks is necessary.
"""
try:
importer = sys.path_importer_cache[path_item]
except KeyError:
for path_hook in sys.path_hooks:
try:
importer = path_hook(path_item)
sys.path_importer_cache.setdefault(path_item, importer)
break
except ImportError:
pass
else:
importer = None
return importer

Does the order in sys.path_hooks matters? We should document it if it does. Btw 
get_importer function is lack of test.

--
components: Library (Lib)
messages: 339000
nosy: Windson Yang
priority: normal
severity: normal
status: open
title: get_importer only return the first valid path_hook(importer)
type: behavior
versions: Python 3.7, Python 3.8, Python 3.9

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



[issue14817] pkgutil.extend_path has no tests

2019-04-17 Thread Windson Yang


Change by Windson Yang :


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

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



[issue14817] pkgutil.extend_path has no tests

2019-04-17 Thread Windson Yang


Windson Yang  added the comment:

I added some tests in the PR. Actually, there are some tests for extend_path 
already (see 
https://github.com/python/cpython/blob/master/Lib/test/test_pkgutil.py#L235). 
However, I didn't test every line of the code in the extend_path function.

--

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



[issue36654] Add example to tokenize.tokenize

2019-04-17 Thread Windson Yang


New submission from Windson Yang :

> The tokenize() generator requires one argument, readline, which must be a 
> callable object which provides the same interface as the io.IOBase.readline() 
> method of file objects. Each call to the function should return one line of 
> input as bytes.

Add an example like this should be easier to understand:

# example.py
def foo:
pass

# tokenize_example.py
import tokenize
f = open('example.py', 'rb')
token_gen = tokenize.tokenize(f.readline)

for token in token_gen:
# Something like this
# TokenInfo(type=1 (NAME), string='class', start=(1, 0), end=(1, 5), 
line='class Foo:\n')
# TokenInfo(type=1 (NAME), string='Foo', start=(1, 6), end=(1, 9), 
line='class Foo:\n')
# TokenInfo(type=53 (OP), string=':', start=(1, 9), end=(1, 10), 
line='class Foo:\n')
print(token)

--
assignee: docs@python
components: Documentation
messages: 340467
nosy: Windson Yang, docs@python
priority: normal
severity: normal
status: open
title: Add example to tokenize.tokenize
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8

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



[issue36661] Missing dataclass decorator import in dataclasses module docs

2019-04-19 Thread Windson Yang


Windson Yang  added the comment:

I can find some example in the docs that didn't `import the correct module` 
even in the first example. Should we add the `import` statement for all of them?

--
nosy: +Windson Yang

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



[issue36661] Missing dataclass decorator import in dataclasses module docs

2019-04-20 Thread Windson Yang


Windson Yang  added the comment:

I agreed most of the documents won't need the change, but some documents like 
https://docs.python.org/3/library/dataclasses.html#dataclasses.field didn't 
mention we have to run `from typing import List` and I guess most developers 
not familiar with this package. I suggest we should add the import statement 
for the uncommon package.

--

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



[issue36679] duplicate method definition in Lib/test/test_genericclass.py

2019-04-20 Thread Windson Yang


Change by Windson Yang :


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

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



[issue36680] duplicate method definition in Lib/test/test_importlib/test_util.py

2019-04-20 Thread Windson Yang


Change by Windson Yang :


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

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



[issue36681] duplicate method definition in Lib/test/test_logging.py

2019-04-20 Thread Windson Yang


Change by Windson Yang :


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

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



[issue36682] duplicate method definitions in Lib/test/test_sys_setprofile.py

2019-04-20 Thread Windson Yang


Change by Windson Yang :


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

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



[issue36682] duplicate method definitions in Lib/test/test_sys_setprofile.py

2019-04-20 Thread Windson Yang


Change by Windson Yang :


--
pull_requests: +12820

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



[issue36683] duplicate method definition in Lib/test/test_utf8_mode.py

2019-04-20 Thread Windson Yang


Change by Windson Yang :


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

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



[issue36678] duplicate method definitions in Lib/test/test_dataclasses.py

2019-04-21 Thread Windson Yang


Change by Windson Yang :


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

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



[issue36654] Add example to tokenize.tokenize

2019-04-24 Thread Windson Yang


Windson Yang  added the comment:

Yes, I can make a PR for it.

--

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



[issue36654] Add example to tokenize.tokenize

2019-04-24 Thread Windson Yang


Change by Windson Yang :


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

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



[issue36731] Add example to priority queue

2019-04-25 Thread Windson Yang


New submission from Windson Yang :

We don't have the base example for priority queue in 
https://docs.python.org/3.8/library/heapq.html#priority-queue-implementation-notes,
 We can add something like:

> q = Q.PriorityQueue()
> q.put(10)
> q.put(1)
> q.put(5)
> while not q.empty():
print q.get()

We may also need to add Notes about the PriorityQueue will block when we use 
max size 

> q = Q.PriorityQueue(1)
> q.put(10)
> q.put(1) # will block until the Queue is available again.

--
assignee: docs@python
components: Documentation
messages: 340878
nosy: Windson Yang, docs@python
priority: normal
severity: normal
status: open
title: Add example to priority queue
type: enhancement
versions: Python 3.8

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



[issue36759] datetime: astimezone() results in OSError: [Errno 22] Invalid argument

2019-04-30 Thread Windson Yang


Windson Yang  added the comment:

on macOS 10.14.4, I got `ValueError: offset must be a timedelta representing a 
whole number of minutes, not datetime.timedelta(0, 29143).` I will do some 
research to see why this happen.

--
nosy: +Windson Yang

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



[issue36759] datetime: astimezone() results in OSError: [Errno 22] Invalid argument

2019-05-01 Thread Windson Yang


Windson Yang  added the comment:

Thanks, SilentGhost, you are right. I will leave this to a Windows expert 
instead.

--

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



[issue36757] uuid constructor accept invalid strings (extra dash)

2019-05-01 Thread Windson Yang


Windson Yang  added the comment:

> Maybe a line should be added in the documentation to prevent people using 
> this as a validator without more check?

I don't expect uuid.UUID could be used as a validator myself, but I agreed we 
can warn users in the documentation if lots of them confuse about it.

------
nosy: +Windson Yang

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



[issue36761] Extended slice assignment + iterable unpacking

2019-05-01 Thread Windson Yang


Windson Yang  added the comment:

In your first case, *any positive index except 2 will work*, For example:

L = [0, 1, 2]
L[::1], *rest = "abcdef" # L became ['a']
or 
L[::3], *rest = "abcdef" # L became ['a', 1, 2]

I found iff when you change the length of L to 1(L[::3]) or didn't change L at 
all (L[::1], L[::]), this expression will work. But I'm not sure that is what 
you expected.

--
nosy: +Windson Yang

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



[issue36762] Teach "import *" to warn when overwriting globals or builtins

2019-05-01 Thread Windson Yang


Windson Yang  added the comment:

Another question will be are we going to replace the * in our source code in 
the future? Since I found lots of our code use 'from xxx import *' pattern.

--
nosy: +Windson Yang

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



[issue34155] email.utils.parseaddr mistakenly parse an email

2019-05-02 Thread Windson Yang


Windson Yang  added the comment:

I found the issue located in 
https://github.com/python/cpython/blob/master/Lib/email/_parseaddr.py#L277

elif self.field[self.pos] in '.@':
# email address is just an addrspec
# this isn't very efficient since we start over
self.pos = oldpos
self.commentlist = oldcl
addrspec = self.getaddrspec()
returnlist = [(SPACE.join(self.commentlist), addrspec)]

The parseaddr function runs a for in loop over the input string, when it meets 
'.@' it will do something. That is why when the input string is 
'f...@bar.com@example.com' will return ('', 'f...@bar.com'). One possible 
solution will be to check the string in the reverse order then we can always 
get the last '@' in the string.

--
nosy: +Windson Yang

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



[issue34155] email.utils.parseaddr mistakenly parse an email

2019-05-03 Thread Windson Yang


Windson Yang  added the comment:

Frome the answer from Alnitak 
(https://stackoverflow.com/questions/12355858/how-many-symbol-can-be-in-an-email-address).
 Maybe we should raise an error when the address has multiple @ in it.

--

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



[issue36823] shutil.copytree copies directories and files but fails with that same directory with '[Errno 1] Operation not permitted')

2019-05-07 Thread Windson Yang


Windson Yang  added the comment:

Just to make sure, the expected behavior would be the items should not be 
copied because of the permission and the error messages above, right?

--
nosy: +Windson Yang

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



[issue18765] unittest needs a way to launch pdb.post_mortem or other debug hooks

2019-05-07 Thread Windson Yang

Windson Yang  added the comment:

Hello, @Rémi, are you still working on this issue?

--
nosy: +Windson Yang

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



[issue36689] docs: os.path.commonpath raises ValueError for different drives

2019-05-12 Thread Windson Yang


Windson Yang  added the comment:

An easy fix would be 

"Raise ValueError if paths contain (note: use contain instead of contains) both 
absolute and relative pathnames or the path are on the different drives."

--
nosy: +Windson Yang

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



[issue30535] Explicitly note that meta_path is not empty

2019-05-13 Thread Windson Yang


Change by Windson Yang :


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

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



[issue30535] Explicitly note that meta_path is not empty

2019-05-13 Thread Windson Yang


Windson Yang  added the comment:

I created a PR for it. TBO, meta_path is not a good name since it doesn't 
contain any *path* at all.

--
nosy: +Windson Yang

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



[issue9267] Update pickle opcode documentation in pickletools for 3.x

2019-05-13 Thread Windson Yang


Windson Yang  added the comment:

Where are the documents actually?

--
nosy: +Windson Yang

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



  1   2   >