[issue45469] lambda issue in for-loop

2021-10-14 Thread Vincent Liang


New submission from Vincent Liang :

Strange behavior is found when lambda is used inside for-loop.

code:(same as attached file)

# begin of CODE
def aa(x):
print("aa")
def bb(x):
print("bb")

namefun = [
("a", aa),
("b", bb),
]
name2fun = {}
for name, fun in namefun:
name2fun[name] = lambda x: fun(x)
# issue happened when calling lambda
name2fun["a"](1)
name2fun["b"](1)
# end of CODE

output:
bb
bb

expected output:
aa
bb

--
components: Interpreter Core
files: test8.py
messages: 403899
nosy: vincent7f
priority: normal
severity: normal
status: open
title: lambda issue in for-loop
type: behavior
versions: Python 3.10, Python 3.9
Added file: https://bugs.python.org/file50357/test8.py

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



[issue40056] more user-friendly turtledemo

2020-03-24 Thread Evin Liang


New submission from Evin Liang :

[minor]
1. Display underscores as spaces in menu bar
2. Allow user to run custom code

--
components: Library (Lib)
messages: 364961
nosy: Evin Liang
priority: normal
pull_requests: 18506
severity: normal
status: open
title: more user-friendly turtledemo
type: enhancement
versions: Python 3.6, Python 3.7, Python 3.8, Python 3.9

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



[issue35323] Windows x86 executable installer can't install

2018-11-26 Thread liang feng


liang feng <1590...@139.com> added the comment:

the file didn't download complete,change other computer download, it's fine

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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



[issue35323] Windows x86 executable installer can't install

2018-11-26 Thread liang feng


New submission from liang feng <1590...@139.com>:

see log

--
files: Python 3.7.1 (32-bit)_20181127100820.log
messages: 330486
nosy: outofthink
priority: normal
severity: normal
status: open
title: Windows x86 executable installer can't install
versions: Python 3.7
Added file: https://bugs.python.org/file47950/Python 3.7.1 
(32-bit)_20181127100820.log

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



[issue29993] error of parsing encoded words in email of standard library

2017-04-05 Thread sijian liang

New submission from sijian liang:

This issue is fixed in python3
see 
https://github.com/python/cpython/commit/07ea53cb218812404cdbde820647ce6e4b2d0f8e

--
components: email
messages: 291171
nosy: barry, r.david.murray, sijian liang
priority: normal
severity: normal
status: open
title: error of parsing encoded words in email of standard library
type: behavior
versions: Python 2.7

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



[issue28798] Describe character as a string of length one instead of size one in tutorial

2016-11-24 Thread Liang-Bo Wang

New submission from Liang-Bo Wang:

In Tutorial "An Informal Introduction" section, character is introduced as a 
string of size one. It may be true for python 2.x, where str can be interpreted 
as bytes. However in Python 3, strings are unicode thus the size and the length 
of a string are usually not the same. Also, using size of a string can be 
confused with the result returned by sys.getsizeof(mystr), where 
sys.getsizeof('a') != 1. 

Therefore using "a string of length one" to describe a character may be less 
confusing. The patch attached changes the wording.

--
assignee: docs@python
components: Documentation
files: docs_tutorial_introduction_str.diff
keywords: patch
messages: 281678
nosy: ccwang002, docs@python
priority: normal
severity: normal
status: open
title: Describe character as a string of length one instead of size one in 
tutorial
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45634/docs_tutorial_introduction_str.diff

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



[issue28122] email.header.decode_header can not decode string with quotation

2016-09-13 Thread sijian liang

New submission from sijian liang:

#!/usr/bin/python
#-*- coding:utf-8 -*-
import email
# from email.parser import Parser
def decode_email_header(header, sep=''):
l = []
for s, c in header:
if c:
l.append(s.decode(c))
else:
l.append(s)
return sep.join(l)
s = email.Header.decode_header('"=?gb18030?B?bWFpbGZvcnRlc3R0?=" 
<2070776...@qq.com>')
print decode_email_header(s)
s = email.Header.decode_header('=?gb18030?B?bWFpbGZvcnRlc3R0?= 
<2070776...@qq.com>')
print decode_email_header(s)


# see output:
#"=?gb18030?B?bWFpbGZvcnRlc3R0?=" <2070776...@qq.com>
#mailfortestt<2070776...@qq.com>

--

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



[issue28122] email.header.decode_header can not decode string with quotation

2016-09-13 Thread sijian liang

Changes by sijian liang :


--
components: email
files: demo.py
nosy: barry, r.david.murray, sijian liang
priority: normal
severity: normal
status: open
title: email.header.decode_header can not decode string with quotation
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file44624/demo.py

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



[issue26457] Error in ipaddress.address_exclude function

2016-02-28 Thread feng liang

New submission from feng liang:

when i read in document 3.5.1,run the example in ipaddress.address_exclude 
function 

>>> n1 = ip_network('192.0.2.0/28')
>>> n2 = ip_network('192.0.2.1/32')
>>> list(n1.address_exclude(n2))  

I got:

Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python 3.5\lib\ipaddress.py", line 794, in address_exclude
s1, s2 = s1.subnets()
ValueError: not enough values to unpack (expected 2, got 1)

--
components: Library (Lib)
messages: 260994
nosy: out
priority: normal
severity: normal
status: open
title: Error in ipaddress.address_exclude function
type: behavior
versions: Python 3.5

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



[issue26246] Code output toggle button uses removed jQuery method

2016-02-26 Thread Liang-Bo Wang

Liang-Bo Wang added the comment:

Thanks for the merge. 

I pulled the change and checked the result, but I found the patch missing a 
line to initiate the correct display state when the button was created. That 
is, it forgot to set `button.data('hidden', 'false');` when adding the button. 

This causes the first click on the button to have no effect. But the following 
clicks will work.

I filed the new patch to add this line back. I'm so sorry I missed this line :(

--
Added file: http://bugs.python.org/file42036/copybutton_js_2.patch

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



[issue26246] Code output toggle button uses removed jQuery method

2016-02-26 Thread Liang-Bo Wang

Liang-Bo Wang added the comment:

Just FYI, I applied the patch to the zh-hant translation of the documentation 
and the code output toggle button is back and works as expected.

https://docs.python.org.tw/3/tutorial/introduction.html#numbers

You can see the result of any other page by changing the URL domain from 
docs.python.org to docs.python.org.tw

--

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



[issue26246] Code output toggle button uses removed jQuery method

2016-01-31 Thread Liang Bo Wang

New submission from Liang Bo Wang:

The code output toggle button (the `>>>` button on the top right) has been 
disappeared and not functional on the current online documentation (both 3.4+ 
and 2.7). 


For example, see any doc page that has interpreter outputs:

https://docs.python.org/3/tutorial/introduction.html#numbers
https://docs.python.org/3.5/tutorial/introduction.html#numbers
https://docs.python.org/3.4/tutorial/introduction.html#numbers
https://docs.python.org/2/tutorial/introduction.html#numbers


These toggle buttons are created dynamically using jQuery by the script at 
Doc/tools/static/copybutton.js. However, the method .toggle() it used for click 
event handling has been deprecated since jQuery 1.8 and removed since jQuery 
1.9.

https://api.jquery.com/toggle-event/


Current Python documentation ships with jQuery v1.11.1 and it has a new 
.toggle() method with totally different behavior, which controls animation and 
hide the element. Therefore those buttons are invisible and has no effect.

https://api.jquery.com/toggle/


To achieve the old behavior, one now needs to create this toggle event on one's 
own. The most popular way to store the toggle state is by jQuery's .data() data 
storage.

A patch is attached to make the button functional again.

--
assignee: docs@python
components: Documentation
files: copybutton_js.patch
keywords: patch
messages: 259279
nosy: Liang Bo Wang, docs@python, eric.araujo, ezio.melotti, georg.brandl
priority: normal
severity: normal
status: open
title: Code output toggle button uses removed jQuery method
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file41764/copybutton_js.patch

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



[issue23299] Documentation correction - 5.1.4. List Comprehensions

2015-01-22 Thread Liang Zhang

Liang Zhang added the comment:

Oh my god! You're right!

--

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



[issue23299] Documentation correction - 5.1.4. List Comprehensions

2015-01-22 Thread Liang Zhang

New submission from Liang Zhang:

This was copied from Chapter 5 Data Structure in Python language tutorial.

The link I was looking for:  
https://docs.python.org/2.7/tutorial/datastructures.html

Some thing might be incorrect and need you to update them in
(5.1.4. List Comprehensions)

It should be like this:
--start--
>>> vec = [-4, -2, 0, 2, 4]
>>> # create a new list with the values doubled
>>> [x*2 for x in vec]
[-8, -4, 0, 4, 8]
>>> # filter the list to exclude negative numbers
>>> [x for x in vec if x >= 0]
[0, 2, 4]
>>> # apply a function to all the elements
>>> [abs(x) for x in vec]
[4, 2, 0, 2, 4] >>>>>>>>>>>It should be [0, 2, 4]<<<<<<<<<<<
--end--

--
assignee: docs@python
components: Documentation
messages: 234485
nosy: Liang.Zhang, docs@python
priority: normal
severity: normal
status: open
title: Documentation correction - 5.1.4. List Comprehensions
type: resource usage
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

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



[issue7332] python script segment fault at PyMarshal_ReadLastObjectFromFile in import_submodule

2009-11-15 Thread liang

New submission from liang :

In our testbed,we have seem serveral sgement fault in our python scrit.
The enviroment is:
linux=2.6.29.6-0.6.smp.gcc4.1.x86_64
python=2.4.4-41.4-1
GCC = GCC 4.1.2 20070626 (rPath Inc.)] on linux2
Below are the detail call stack:
(gdb) bt
#0  PyMarshal_ReadLastObjectFromFile (fp=0x73a550) at 
Python/marshal.c:748
#1  0x0047bbf9 in read_compiled_module 
(cpathname=0x7fff184ba600
"/usr/lib64/python2.4/sre_constants.pyc", 
fp=0x73a550) at Python/import.c:728
#2  0x0047da2c in load_source_module (name=0x7fff184bc740
"sre_constants", pathname=0x7fff184bb680 
"/usr/lib64/python2.4/sre_constants.py", fp=0x737df0)
at Python/import.c:896
#3  0x0047e7bd in import_submodule (mod=0x6ea570,
subname=0x7fff184bc740 "sre_constants", fullname=0x7fff184bc740 
"sre_constants") at Python/import.c:2276
#4  0x0047ec3c in load_next (mod=0x6ea570, altmod=0x6ea570,
p_name=, buf=0x7fff184bc740 
"sre_constants", p_buflen=0x7fff184bc73c)
at Python/import.c:2096
#5  0x0047ee47 in PyImport_ImportModuleEx 
(name=0x7fff18bac298 "\001",
globals=0x7fff18bac2bc, locals=, fromlist=0x7fff18c90990)
at Python/import.c:1931
#6  0x0045f963 in builtin___import__ (self=,
args=) at 
Python/bltinmodule.c:45
#7  0x004148e0 in PyObject_Call (func=0x73a550, arg=0x73a550,
kw=0x46e829e3) at Objects/abstract.c:1795
#8  0x004628fd in PyEval_CallObjectWithKeywords 
(func=0x7fff18ca5440,
arg=0x7fff18c944c8, kw=0x0) at 
Python/ceval.c:3435
#9  0x0046461a in PyEval_EvalFrame (f=0x744650) at 
Python/ceval.c:2020
#10 0x00468ce0 in PyEval_EvalCodeEx (co=0x7fff18c95ab0, 
globals=, locals=, 
args=0x0, argcount=0, kws=0x0, kwcount=0,
defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2741
#11 0x00468d92 in PyEval_EvalCode (co=0x73a550, 
globals=0x73a550,
locals=0x46e829e3) at Python/ceval.c:484
#12 0x0047d29a in PyImport_ExecCodeModuleEx 
(name=0x7fff184bfce0
"sre_compile", co=0x7fff18c95ab0, 
pathname=0x7fff184bdba0 "/usr/lib64/python2.4/sre_compile.pyc")
at Python/import.c:636
#13 0x0047d7d0 in load_source_module (name=0x7fff184bfce0
"sre_compile", pathname=0x7fff184bdba0 
"/usr/lib64/python2.4/sre_compile.pyc", fp=)
at Python/import.c:915
#14 0x0047e7bd in import_submodule (mod=0x6ea570,
subname=0x7fff184bfce0 "sre_compile", fullname=0x7fff184bfce0 
"sre_compile") at Python/import.c:2276
#15 0x0047ec3c in load_next (mod=0x6ea570, altmod=0x6ea570,
p_name=, buf=0x7fff184bfce0 
"sre_compile", p_buflen=0x7fff184bfcdc)
at Python/import.c:2096
#16 0x0047ee47 in PyImport_ImportModuleEx 
(name=0x7fff18c8fbd0 "\001",
globals=0x7fff18c8fbf4, locals=, fromlist=0x6ea570) at Python/import.c:1931
#17 0x0045f963 in builtin___import__ (self=,
args=) at 
Python/bltinmodule.c:45
#18 0x004148e0 in PyObject_Call (func=0x73a550, arg=0x73a550,
kw=0x46e829e3) at Objects/abstract.c:1795
#19 0x004628fd in PyEval_CallObjectWithKeywords 
(func=0x7fff18ca5440,
arg=0x7fff18c94208, kw=0x0) at 
Python/ceval.c:3435
#20 0x0046461a in PyEval_EvalFrame (f=0x7b6680) at 
Python/ceval.c:2020
#21 0x00468ce0 in PyEval_EvalCodeEx (co=0x7fff18c95500, 
globals=, locals=, 
args=0x0, argcount=0, kws=0x0, kwcount=0,
defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2741
#22 0x00468d92 in PyEval_EvalCode (co=0x73a550, 
globals=0x73a550,
locals=0x46e829e3) at Python/ceval.c:484
#23 0x0047d29a in PyImport_ExecCodeModuleEx 
(name=0x7fff184c3280 "sre",
co=0x7fff18c95500, pathname=0x7fff184c1140 
"/usr/lib64/python2.4/sre.pyc")
at Python/import.c:636
#24 0x0047d7d0 in load_source_module 
(name=0x7fff184c3280 "sre",
pathname=0x7fff184c1140 
"/usr/lib64/python2.4/sre.pyc", fp=)
at Python/import.c:915
#25 0x0047e7bd in import_submodule (mod=0x6ea570,
subname=0x7fff184c3280 "sre", fullname=0x7fff184c3280 "sre") at 
Python/import.c:2276
#26 0x0047ec3c in load_next (mod=0x6ea570, altmod=0x6ea570,
p_name=, buf=0x7fff184c3280 "sre", 
p_buflen=0x7fff184c327c) at Python/import.c:2096
#27 0x0047ee47 in PyImport_ImportModuleEx 
(name=0x7fff18c8cc90 "\001",
globals=0x7fff18c8ccb4, locals=, fromlist=0x7fff18c90450)
at Python/import.c:1931
#28 0x0045f963 in builtin___import__ (self=,
args=) at 
Python/bltinmodule.c:45
#29 0x004148e0 in PyObject_Call (func=0x73a550, arg=0x73a550,
kw=0x46e829e3) at Objects/abstract.c:1795
#30 0x004628fd in PyEval_CallObjectWithKeywords 
(func=0x7fff18ca5440,
arg=0x7fff18c83788, kw=0x0) at 
Python/ceval.c:3435
#31 0x0046461a in PyEval_EvalFrame (f=0x753bb0) at 
Python/ceval.c:2020
#32 0x00468ce0 in PyEval_EvalCodeEx (co=0x7fff18c8a7a0, 
globa

[issue5670] Speed up pickling of dicts in cPickle

2009-04-19 Thread Kelvin Liang

Kelvin Liang  added the comment:

Can this patch be used or ported to 2.5.x?

--
nosy: +feisan

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