[issue33972] AttributeError in email.message.iter_attachments()

2018-07-01 Thread Bradley Laney


Bradley Laney  added the comment:

Hey Sven,

New here, decided to try a bit at an issue. 

According to the email.message docs, "the payload is either a string or bytes 
object, in the case of simple message objects, or a list of EmailMessage 
objects, for MIME container documents such as multipart/* and message/rfc822 
message objects."

Like you said, this error happens if the email.message.EmailMessage object is 
bad, i.e. the payload is a string or bytes but the content-type is marked as 
multipart/*. After reading online, it seems like an error is necessary.

I've proposed a small change in a pull request to make this situation raise a 
more useful error. It doesn't blow up any earlier but it at least says 
something more useful. 

The function could return instead of throwing an error, just providing an empty 
iterator, but that seems even less useful.

I fixed it on master (3.8 dev or whatever).

Best,
Brad

--
nosy: +Bradley Laney
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue33972] AttributeError in email.message.iter_attachments()

2018-07-01 Thread Roundup Robot


Change by Roundup Robot :


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

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

@corona10 You might want to discuss this at 
https://mail.python.org/pipermail/python-ideas/ so that you get some initial 
feedback on the work and it's acceptance to the core.

Thanks

--

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2018-07-01 Thread Mark Hammond


Mark Hammond  added the comment:

pywin32, up until recently, just listed 3 directories in its .pth file - these 
were for directories which pre-dated packages and were never converted. Eg, 
"import win32api" actually loads win32api.pyd from the "site-packages/win32" 
directory.

Earlier this year, via https://github.com/mhammond/pywin32/issues/1151, I also 
added the line:

import os;os.environ["PATH"]+=(';'+os.path.join(sitedir,"pywin32_system32"))

which is to support pywin32 being installed from wheels - this is due to 
pywin32 shipping with various shared DLLs which implement many pywin32 types - 
eg, pywintypesXX.dll is used by (almost) every single .pyd shipped with 
pywin32, and disutils doesn't offer any way of copying files as part of a 
post-install script or any other way of ensuring these .dll files are on the 
PATH or otherwise next to pythonXX.dll/.exe

I'm happy to replace both of these with alternatives when they exist.

--

___
Python tracker 

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



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

2018-07-01 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Okay, I'll mark this as on-hold until you find the relevant code.

I'm not sure why you think modifying the class definition would look weird.  
That is the normal and intended place to put methods.  Likely, the only reason 
that you had any success at all when attaching a function to an instance was 
that it didn't need access to either "self" or "class".

--
resolution:  -> later
versions: +Python 3.8 -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



[issue34010] tarfile stream read performance

2018-07-01 Thread INADA Naoki


INADA Naoki  added the comment:

Nice catch.

I confirmed this is a hard regression of performance.
Decompressing a file must be O(n) when n=filesize, but O(n^2) now.

While we live with this regression for a long time, I feel it's worth enough to 
backport.
This can be DoS vulnerability.

Can you write NEWS entry for it?

--
nosy: +inada.naoki

___
Python tracker 

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



[issue33995] test_min_max_version in test_ssl.py fails when Python is built against LibreSSL; {min,max}imum_version behavior differs from OpenSSL

2018-07-01 Thread Alan Huang


Change by Alan Huang :


--
components:  -Documentation
versions: +Python 3.8

___
Python tracker 

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



[issue34016] Bug in sort()

2018-07-01 Thread Lucas Sampaio


Lucas Sampaio  added the comment:

ok, I got it

lista4 = input().split()
print(lista4)
lista4.sort()
print(lista4)

print(type(lista4[2]))

 6 8 10['6', '8', '10']
['10', '6', '8']


ok, I got it

2018-07-01 18:05 GMT-03:00 Tim Peters :

>
> Tim Peters  added the comment:
>
> Lucas, as Mark said you're sorting _strings_ here, not sorting integers.
> Please study his reply.  As strings, "10" is less than "9", because "1" is
> less than "9".
>
> >>> "10" < "9"
> True
> >>> 10 < 9
> False
>
> --
> nosy: +tim.peters
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue34016] Bug in sort()

2018-07-01 Thread Tim Peters


Tim Peters  added the comment:

Lucas, as Mark said you're sorting _strings_ here, not sorting integers.  
Please study his reply.  As strings, "10" is less than "9", because "1" is less 
than "9".

>>> "10" < "9"
True
>>> 10 < 9
False

--
nosy: +tim.peters

___
Python tracker 

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



[issue34016] Bug in sort()

2018-07-01 Thread Lucas Sampaio


Lucas Sampaio  added the comment:

same code with another input
type is list

lista4 = input().split()
print(lista4)
lista4.sort()
print(lista4)

 6 8 9
['6', '8', '9']
['6', '8', '9']


lista4 = input().split()
print(lista4)
lista4.sort()
print(lista4)

 10 11 12
 
['10', '11', '12']
['10', '11', '12']

but if you put a 9 

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



[issue34016] Bug in sort()

2018-07-01 Thread Mark Dickinson


Mark Dickinson  added the comment:

This isn't a bug: I'm guessing that you expected an output of `['6', '8', 
'10']`, but in the example you give you're sorting strings rather than numbers, 
and those strings are sorted lexicographically (i.e., using "dictionary order") 
as normal.

If you want to do a numeric sort, convert your inputs to numbers first.

>>> lista4 = ['6', '8', '10']
>>> lista4_numbers = [int(s) for s in lista4]
>>> lista4_numbers.sort()
>>> lista4_numbers
[6, 8, 10]

--
nosy: +mark.dickinson
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue34016] Bug in sort()

2018-07-01 Thread Lucas Sampaio


New submission from Lucas Sampaio :

lista4 = input().split()
print(lista4)
lista4.sort()
print(lista4)

Input = 6 8 10

Output:
 6 8 10
['6', '8', '10']
['10', '6', '8']

a bug occurs when setting the 10

--
messages: 320843
nosy: lucassdssampaio
priority: normal
severity: normal
status: open
title: Bug in sort()
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



[issue33955] Implement PyOS_CheckStack on macOS using pthread_get_stack*_np

2018-07-01 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Sure. I'm not working on this at the moment.

--

___
Python tracker 

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



[issue31415] Add -X option to show import time

2018-07-01 Thread Nico Schlömer

Nico Schlömer  added the comment:

I just updated tuna [1] to support import time profiles as well.
Install with
```
pip install tuna
```
and use with
```
python -X importprofile yourfile.py 2> import.log
tuna import.log
```
See screenshot for example output.

Cheers,
Nico

[1] https://github.com/nschloe/tuna

--
nosy: +nschloe
Added file: https://bugs.python.org/file47663/sc.png

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

And here's my work in progress patch.

https://github.com/corona10/cpython/commit/133825346fd60e518e9ab5830a0755250c8c3e79

--

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thanks,

my easy patch is worked by pre-checking left paren index. but some edge case 
which I don't expect should be considered.

 if (left_paren_index != -1) {
-/* Use default error message for any line with an opening paren */
-return 0;
+   int found_white_space = 0;
+   int found_other_char = 0;
+   Py_ssize_t pos = 0;
+   while(pos != left_paren_index) {
+   int kind = PyUnicode_KIND(self->text);
+   void *data = PyUnicode_DATA(self->text);
+Py_UCS4 ch = PyUnicode_READ(kind, data, pos);
+   if (Py_UNICODE_ISSPACE(ch)) {
+found_white_space = 1;
+   }
+   if (!Py_UNICODE_ISSPACE(ch) && found_white_space == 1) {
+found_other_char = 1;
+   }
+   pos++;
+   }
+
+   if (found_other_char == 0) {
+   return 0;
+   }
 }


Type "help", "copyright", "credits" or "license" for more information.
>>> print (foo.)
  File "", line 1
print (foo.)
   ^
SyntaxError: invalid syntax

>>> print "a".toupper().tolower()
  File "", line 1
print "a".toupper().tolower()
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print("a".toupper().tolower())?

SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print(Foo().header(a=foo(1)))?

--

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

>>> class Foo:
... pass
...
>>> print Foo().header(a=foo(1))
  File "", line 1
print Foo().header(a=foo(1))
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print(Foo().header(a=foo(1)))?

--

___
Python tracker 

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



[issue33660] pathlib.Path.resolve() returns path with double slash when resolving a relative path in root directory

2018-07-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

Please review my pull request.
This PR is pending for 19 days.

--

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

I took an initial stab at this and there is a comment where if there is an open 
paren then to use the normal error message. Additional context on the issue 
which lists false positive cases where the change was introduced 
https://bugs.python.org/issue21669. I removed the check where the left paren 
count is not -1 in case of a function call and it seems to work. Of course, 
there are cases to handle as mentioned in the linked issue and I tried some of 
the cases like "foo".toupper().tolower() and the results as below : 

Patch : 

diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index bb50c1c..7e616cf 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -2966,10 +2966,7 @@ _report_missing_parentheses(PySyntaxErrorObject *self)
 if (left_paren_index < -1) {
 return -1;
 }
-if (left_paren_index != -1) {
-/* Use default error message for any line with an opening paren */
-return 0;
-}
+
 /* Handle the simple statement case */
 legacy_check_result = _check_for_legacy_statements(self, 0);
 if (legacy_check_result < 0) {

Cases :

➜  cpython git:(master) ✗ cat foo_print.py
class Foo:
pass

print Foo().header(a=foo(1))
➜  cpython git:(master) ✗ ./python foo_print.py
  File "foo_print.py", line 4
print Foo().header(a=foo(1))
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print(Foo().header(a=foo(1)))?

➜  cpython git:(master) ✗ cat foo_print.py
print "a".toupper().tolower()
➜  cpython git:(master) ✗ ./python foo_print.py
  File "foo_print.py", line 1
print "a".toupper().tolower()
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean 
print("a".toupper().tolower())?


Linked cases in the patch : 

➜  cpython git:(master) ✗ cat foo_print.py
print (foo.)
➜  cpython git:(master) ✗ ./python foo_print.py
  File "foo_print.py", line 1
print (foo.)
   ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print((foo.))?


Would like to link to https://hackmd.io/s/ByMHBMjFe#08-Debugging-Python-Objects 
. As a beginner the tutorial was helpful and I had to set a break point on 
Objects/exceptions.c:1323 where SyntaxError_init is called and then execute 
line by line where the current code returns the left_paren_index which you can 
set as `set left_paren_index = -1` to skip the branch and then continue the 
program to print the above error messages. IMO I think it was an explicit 
decision with this change being done 4 years ago with the false positive cases 
and tests listed but I am curious if there are any improvements in this area to 
be done.


Thanks

--

___
Python tracker 

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



[issue34015] doc Add link to Descriptor HowTo Guide in Data Model

2018-07-01 Thread Andrés Delfino

Andrés Delfino  added the comment:

ok :) I have just updated the PR following your comment.

--

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Piyush Hajare


Piyush Hajare <4piyushhaj...@gmail.com> added the comment:

I'm interested to solve this issue

--
nosy: +piyushhajare

___
Python tracker 

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



[issue33996] Crash in gen_send_ex(): _PyErr_GetTopmostException() returns freed memory

2018-07-01 Thread Mark Shannon


Mark Shannon  added the comment:

This looks like a Greenlet bug to me.
Possibly 
https://github.com/python-greenlet/greenlet/commit/780a12b51fcef9adcc4f2c9a4cc5b05c2d652ba4
 is incomplete.

It is not clear to me why greenlets hold their own exception state, but I 
suspect that if they didn't then this issue might go away.

--

___
Python tracker 

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



[issue33996] Crash in gen_send_ex(): _PyErr_GetTopmostException() returns freed memory

2018-07-01 Thread Mark Shannon


Mark Shannon  added the comment:

Strange. 
I could only reproduce this intermittently with 3.7 build.
But with a debug build, I cannot reproduce this at all.
Rebuilding Python (optimised, but without PGO) I cannot reproduce at all now.

--

___
Python tracker 

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



[issue20304] Argument Clinic: char convertor should use default values of type bytes

2018-07-01 Thread Tal Einat


Change by Tal Einat :


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

___
Python tracker 

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



[issue33996] Crash in gen_send_ex(): _PyErr_GetTopmostException() returns freed memory

2018-07-01 Thread Miro Hrončok

Change by Miro Hrončok :


--
nosy: +hroncok

___
Python tracker 

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



[issue20304] Argument Clinic: char convertor should use default values of type bytes

2018-07-01 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-8039, which fixes this in order to AC convert 
Objects/stringlib/transmogrify.h.

--
versions: +Python 3.8 -Python 3.4

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2018-07-01 Thread Tal Einat


Tal Einat  added the comment:

See updated PR for Objects/stringlib/transmogrify.h in GH-8039.

--
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2018-07-01 Thread Tal Einat


Change by Tal Einat :


--
pull_requests: +7648

___
Python tracker 

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



[issue34015] doc Add link to Descriptor HowTo Guide in Data Model

2018-07-01 Thread INADA Naoki


INADA Naoki  added the comment:

I think "See also" is better than sidebar.
Many other sections in data-model chapter have it.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Dong-hee Na


Dong-hee Na  added the comment:

@xtreak

Thanks, I have interest with this issue :)
I will take a look at the implementation

Thanks!

--

___
Python tracker 

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



[issue34006] Windows HTML Help (chm) has fixed line length

2018-07-01 Thread INADA Naoki

INADA Naoki  added the comment:

http://www.sphinx-doc.org/en/master/theming.html#builtin-themes

> body_max_width (int or str): Maximal width of the document body. This can be 
> an int, which is interpreted as pixels or a valid CSS dimension string such 
> as ‘70em’ or ‘50%’. Use ‘none’ if you don’t want a width limit. Defaults may 
> depend on the theme (often 800px).

Maybe, all you we need to do is adding "-D 
html_theme_options.body_max_width=none" option to sphinx-build when building 
html for htmlhelp, in Doc/make.bat.

I confirmed this option works with "make html", but I don't have environment 
for building htmlhelp for now.

--

___
Python tracker 

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



[issue30660] Lossless Optimization of PNG files

2018-07-01 Thread INADA Naoki


Change by INADA Naoki :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue30660] Lossless Optimization of PNG files

2018-07-01 Thread INADA Naoki


INADA Naoki  added the comment:


New changeset c6cd164cffedb306a4c6644d9d03072f24da246d by INADA Naoki in branch 
'master':
bpo-30660: Doc: Optimize PNG files by optipng (GH-8032)
https://github.com/python/cpython/commit/c6cd164cffedb306a4c6644d9d03072f24da246d


--

___
Python tracker 

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



[issue34006] Windows HTML Help (chm) has fixed line length

2018-07-01 Thread INADA Naoki


INADA Naoki  added the comment:

I prefer limiting width on browser, but I'm OK to remove limitation from chm 
files.

Rational:

Changing window size to control line width for readable length is bad UX 
because all modern browsers are tabbed.  Or it may be impossible on iPad.

On the other hand, chm is file format only on Windows.  And window is dedicated 
to Python doc.  User can control width easily than browser.

--

___
Python tracker 

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



[issue34013] Inconsistent SyntaxError for print

2018-07-01 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Related issue that introduced the error message if you would like to take a 
look at the implementation : https://bugs.python.org/issue30597

Thanks

--
nosy: +xtreak

___
Python tracker 

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