Here's a review. http://bugs.python.org/review/12720/diff/3188/9927 File Doc/library/os.rst (right): http://bugs.python.org/review/12720/diff/3188/9927#newcode1919 Doc/library/os.rst:1919: must be a bytes or str ...
The FD -> char * cast is really ugly, and it's implementation-defined behavior.
How about using a tagged union instead?
http://bugs.python.org/review/12720/diff/3263/10150
File Modules/posixmodule.c (right):
http://bugs.python.org/review/12720/diff/3263/10150#newcode10002
Modules/posixmodule.c:10002: if (!try_getxattr(path, name, get, 128, &value))
Don't you mean XATTR_BUF_SIZE instead of hard-coded 128?
http://bugs.python.org/review/12720/diff/3263/10150#newcode10068
Modules/posixmodule.c:10068: res = getxattr_common((const char *)fd, name,
wrap_fgetxattr);
On 2011/08/28 18:34:13, AntoinePitrou wrote:
> I'm no C lawyer, but maybe you should be casting to unsigned before casting to
a
> pointer. Otherwise I don't know if there might be some sign extension.
Correct. But the problem is that this is really implementation behavior: AFAICT,
this could perfectly break on a specific platform/compiler. Plus, it's really
ugly :-(
http://bugs.python.org/review/12720/diff/3263/10150#newcode10243
Modules/posixmodule.c:10243: len = try_listxattr(path, list, 256, &buf);
XATTR_BUF_SIZE
http://bugs.python.org/review/12720/diff/3263/10150
File Modules/posixmodule.c (right):
http://bugs.python.org/review/12720/diff/3263/10150#newcode10002
Modules/posixmodule.c:10002: if (!try_getxattr(path, name, get, 128, &value))
On 2011/08/28 20:02:17, Charles-François Natali wrote:
> Don't you mean XATTR_BUF_SIZE instead of hard-coded 128?
Actually I meant to remove the XATTR_BUF_SIZE define.
http://bugs.python.org/review/12720/diff/3263/10150#newcode10068
Modules/posixmodule.c:10068: res = getxattr_common((const char *)fd, name,
wrap_fgetxattr);
On 2011/08/28 20:02:17, Charles-François Natali wrote:
> On 2011/08/28 18:34:13, AntoinePitrou wrote:
> > I'm no C lawyer, but maybe you should be casting to unsigned before casting
to
> a
> > pointer. Otherwise I don't know if there might be some sign extension.
>
> Correct. But the problem is that this is really implementation behavior:
AFAICT,
> this could perfectly break on a specific platform/compiler. Plus, it's really
> ugly :-(
In my latest patch I have (const char *)(Py_uintptr_t)fd. Where is that
implementation defined?
Issue 12720: Expose linux extended filesystem attributes
Created 1 year, 9 months ago by Benjamin Peterson
Modified 1 year, 9 months ago
Reviewers: neologix_free.fr, AntoinePitrou
Base URL: None
Comments: 18