Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ae16484

Browse files
committed
Addressing review for more cleanup and clarification
1 parent 1dde871 commit ae16484

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

numpy/core/_add_newdocs.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,9 @@
13161316
decimal numbers, an operation which is better spelt
13171317
``frombuffer(string, dtype, count)``. If `string` contains unicode
13181318
text, the binary mode of `fromstring` will first encode it into
1319-
bytes using utf-8 (python 3) which does not produce sane results.
1319+
bytes using either utf-8 (python 3) or the default encoding
1320+
(python 2), neither of which produce sane results.
1321+
13201322
${ARRAY_FUNCTION_LIKE}
13211323
13221324
.. versionadded:: 1.20.0

numpy/core/include/numpy/npy_3kcompat.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/*
22
* This is a convenience header file providing compatibility utilities
33
* for supporting different minor versions of Python 3.
4+
* It was originally used to support the transition from Python 2,
5+
* hence the "3k" naming.
46
*
57
* If you want to use this for your own projects, it's recommended to make a
68
* copy of it. Although the stuff below is unlikely to change, we don't provide

numpy/lib/format.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,7 @@ def _wrap_header(header, version):
370370
import struct
371371
assert version is not None
372372
fmt, encoding = _header_size_info[version]
373-
if not isinstance(header, bytes):
374-
header = header.encode(encoding)
373+
header = header.encode(encoding)
375374
hlen = len(header) + 1
376375
padlen = ARRAY_ALIGN - ((MAGIC_LEN + struct.calcsize(fmt) + hlen) % ARRAY_ALIGN)
377376
try:

0 commit comments

Comments
 (0)