[issue30242] resolve undefined behaviour in struct

2017-05-14 Thread Xiang Zhang

Changes by Xiang Zhang :


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

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-14 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset 982a17e02d99dcf6e4dff93110cff5ecc59247f5 by Xiang Zhang in branch 
'2.7':
bpo-30242: resolve some undefined behaviours in struct (#1418) (#1588)
https://github.com/python/cpython/commit/982a17e02d99dcf6e4dff93110cff5ecc59247f5


--

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-14 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset dd2a09cf98845b1460f0e049ad0ffeeb5c6c6476 by Xiang Zhang in branch 
'3.5':
bpo-30242: resolve some undefined behaviours in struct (#1418) (#1587)
https://github.com/python/cpython/commit/dd2a09cf98845b1460f0e049ad0ffeeb5c6c6476


--

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-14 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset aad1caf55f7fadb00ee097a1465bece4e128d8ef by Xiang Zhang in branch 
'3.6':
bpo-30242: resolve some undefined behaviours in struct (#1418) (#1586)
https://github.com/python/cpython/commit/aad1caf55f7fadb00ee097a1465bece4e128d8ef


--

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-14 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +1681

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-14 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +1680

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-14 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +1679

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-14 Thread Xiang Zhang

Xiang Zhang added the comment:


New changeset 981096f98b9c131594b0ac85ad01b63cbd11aa0a by Xiang Zhang in branch 
'master':
bpo-30242: resolve some undefined behaviours in struct (#1418)
https://github.com/python/cpython/commit/981096f98b9c131594b0ac85ad01b63cbd11aa0a


--

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Your patch LGTM as a minimal patch for backporting to maintained releases 
(maybe Mark have other comments). But I think it would be better to make all 
pointers to raw memory of type unsigned char*. Not just packing, but unpacking 
too. Using even memcpy between long* and char* is undefined behavior, the 
source and target should either have the same type, or one of them be unsigned 
char*.

--

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-03 Thread Xiang Zhang

Xiang Zhang added the comment:

Hmm, do we need to? Currently all pack routines accept a char *p. Converting it 
to unsigned char * inside could also solve the problem.

--

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I meant changing the type of the first argument of np_ubyte() etc.

np_ubyte(unsigned char *p, PyObject *v, const formatdef *f)

--

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-02 Thread Xiang Zhang

Xiang Zhang added the comment:

> I think it is better to change the type of p to unsigned char.

Good advice.

--

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-02 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think it is better to change the type of p to unsigned char.

--

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-02 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +1524

___
Python tracker 

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



[issue30242] resolve undefined behaviour in struct

2017-05-02 Thread Xiang Zhang

New submission from Xiang Zhang:

In struct there are several places using code like:

  p[--i] = (char)x;

to extract the least significant byte from a long. Although this behaviour 
seems to apply to common implementations but it does not conform to C standard.

--
components: Library (Lib)
messages: 292836
nosy: mark.dickinson, meador.inge, serhiy.storchaka, xiang.zhang
priority: normal
severity: normal
stage: patch review
status: open
title: resolve undefined behaviour in struct
type: behavior
versions: Python 2.7, 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