531 Commits

Author SHA1 Message Date
Devon Hollowood
fa50056fce Apply suggestions from code review
Co-authored-by: Jeong YunWon <69878+youknowone@users.noreply.github.com>
2022-10-27 18:20:50 -07:00
Devon Hollowood
3739372d43 Implement more accurate hypot()
This uses the improved-accuracy hypotenuse algorithm from Borges 2019,
see https://arxiv.org/abs/1904.09481.
2022-10-26 23:44:13 -07:00
Devon Hollowood
4cfe1453e1 Accept reviewer suggestion
Co-authored-by: Jeong YunWon <69878+youknowone@users.noreply.github.com>
2022-10-25 10:49:09 -07:00
Devon Hollowood
82b4990224 Use improved log2() implementation for log10()
This also fixes a bug in the log2() implementation, where very large
negative integer arguments would not raise an exception (and instead
would turn into NaNs).
2022-10-24 18:46:49 -07:00
Devon Hollowood
893f86e9cf Respond to reviewer comments 2022-10-23 10:17:43 -07:00
Devon Hollowood
beeb0441ef Allow log2() to work on large integers 2022-10-22 14:55:14 -07:00
Jeong YunWon
6d140fb0e7 Merge pull request #4223 from youknowone/nightly-clippy
Fix nightly clippy warnings
2022-10-17 13:28:53 +09:00
Jeong YunWon
00dc025463 Merge pull request #4228 from gilteunchoi/remove-old-doc-remark
remove most of old __doc__ remarks
2022-10-17 11:59:51 +09:00
Steve Shi
2c5cacf9f2 Refactor Mapping Protocol (#4222) 2022-10-17 09:51:22 +09:00
gilteun
227034d36b remove most of old __doc__ remarks 2022-10-17 09:00:01 +09:00
Steve Shi
30aeb8bee5 Introduce PyAtomicRef and impl for PyObject.typ (#3828)
* introduce PyAtomicRef

* refactor PyObject.typ use PyAtomicRef

* add documents

* add swap_to_temporary_refs

* replace AtomicCell with PyAtomic

* fix name conflict
2022-10-15 21:53:12 +02:00
Jeong YunWon
d94f638784 Fix nightly clippy warnings 2022-10-16 02:38:50 +09:00
Jeong YunWon
185e0cb62d clippy is platform-dependent 2022-10-15 15:53:39 +09:00
Steve Shi
273ffd969c Optimize PyType Creation (#4209) 2022-10-11 15:05:52 +09:00
Steve Shi
186990f4f2 Refactor Sequence Protocol (#4137)
* Refactor Sequence Protocol

* rebase

* fixup

* fix inherit slots

* rebase

* fix io slot_init

* mark unsuccess test_xml_etree
2022-10-10 20:21:15 +02:00
Ethan Post
c2a5acb40c Implements 6 os/posix constants missing for macos (#4110) 2022-09-26 15:48:48 +09:00
Jeong YunWon
e002191a48 pyproperty -> pygetset
Though it actually create a getset descriptor,
we didn't change the name because its concept was a property for writers.
Now we have `pymember`, another property-like descriptor. So naming them under
same level would be less confusing instead of telling everybody
"it is a getset but we call it pyproperty"
2022-09-18 14:18:49 +09:00
Jeong YunWon
368e47cddb Merge pull request #4151 from jopemachine/add-cbrt
Add `math.cbrt` implemented in cpython 3.11
2022-09-12 13:55:56 +09:00
Gyubong
e0f491ea8c Fix edge case of math.pow(0.0, -inf), math.pow(-0.0, -inf) 2022-09-12 12:45:56 +09:00
Gyubong
96fc308c04 Add math.cbrt
Update math.rs
2022-09-12 12:39:53 +09:00
Gyubong
1933e5f56e Add math.exp2 2022-09-08 17:00:42 +09:00
Jeong YunWon
e400c60ed8 Remove _platform RustPython-only module 2022-09-03 23:27:13 +09:00
Richard Hozák
31fdb204d8 Allow fcntl functions to accept objects with fileno() function (#4144)
As specified in Python official documentation
(https://docs.python.org/3.10/library/fcntl.html)

> All functions in this module take a file descriptor fd as their first
> argument. This can be an integer file descriptor, such as returned by
> sys.stdin.fileno(), or an io.IOBase object, such as sys.stdin itself,
> which provides a fileno() that returns a genuine file descriptor.

And clarified more in fcntl.fcntl function:

> Perform the operation cmd on file descriptor fd (file objects
> providing a fileno() method are accepted as well).

All function in fcntl modules should accept either int fd or object with
fileno() function which returns int fd.

This was already implemented with for `fcntl.fcntl` function with
`io::Fildes` newtype helper which extracted either int fd or called
fileno() function, and it was also implemented with duplicated ad-hoc
code for `fcntl.ioctl`.

This commit replaces the ad-hoc implementation with `io::Fildes` and
adds it to missing functions: `fcntl.flock` and `fcntl.lockf`.

For more information that this is implemented in the same way as
CPython, you can check the corresponding CPython module:
https://github.com/python/cpython/blob/3.10/Modules/clinic/fcntlmodule.c.h

The functions are: `fcntl_fcntl`, `fcntl_ioctl`, `fcntl_flock` and
`fcntl_lockf`, all of these functions use
`_PyLong_FileDescriptor_Converter` which does the same thing as
RustPython's `io::Fildes`, meaning it either extracts the argument as
int fd or calls fileno() function on passed object that returns the int
fd.

Here is the implementation for `_PyLong_FileDescriptor_Converter`:
https://github.com/python/cpython/blob/3.10/Objects/fileobject.c#L227
which in turns calls `PyObject_AsFileDescriptor` which is located here
https://github.com/python/cpython/blob/3.10/Objects/fileobject.c#L180 in
the same file and we can see that it tries to convert it to int or call
fileno() function.

Note regarding the python unit tests `test_flock`,
`test_lockf_exclusive`, `test_lockf_shared`:

The tests no longer fail with `TypeError: 'BufferedRandom' object cannot
be interpreted as an integer` which makes `test_flock` pass the test,
but `test_lockf_exclusive` and `test_lockf_exclusive` still fail but not
on fcntl calls, they fail on `Process()` constructor with
`AttributeError: module 'os' has no attribute 'fork'` which seems
unrelated with this change.

This unrelated error was probably never detected as fcntl calls failed
earlier, before `Process()` could even be called.
2022-09-02 02:39:02 +09:00
tgsong827
d7cb77ecf2 update fcntl.ioctl's first arg can take other objects having fileno method not only Integer 2022-08-30 09:52:04 +09:00
Jeong YunWon
07e339a7fb Create vm::compiler to handle CompileError variations 2022-08-23 01:43:19 +09:00
Jeong YunWon
6eeaf976a2 sort Cargo.toml dependencies 2022-08-22 08:42:20 +09:00
Jeong YunWon
86118d5276 drop compiler dependencies from stdlib 2022-08-22 04:43:03 +09:00
Jeong YunWon
fb5ac9e79b reorganize compiler crates 2022-08-22 04:42:42 +09:00
Noa
ead2a392cc Update nix and rustyline 2022-08-18 20:02:17 -05:00
Noa
d146cdb7df Remove nullable_socket impl now that socket2::Socket has a niche 2022-08-18 20:01:56 -05:00
Jeong YunWon
1dce933556 Merge pull request #4091 from youknowone/pin-crossbeam-utils
pin crossbeam-utils for 0.8.9 to avoid build error
2022-08-18 06:43:22 +09:00
Jeong YunWon
d39a3df5c7 pin crossbeam-utils for 0.8.9 to avoid build error 2022-08-18 05:51:10 +09:00
Jeong YunWon
93d18bc0c0 rework pylib to generate all frozen libs 2022-08-18 05:44:10 +09:00
Jeong YunWon
27040c01b0 Fix nightly clippy 2022-08-16 09:02:42 +09:00
Jeong YunWon
50aa730aad Merge pull request #4058 from tgsong827/ssl-reason
Add 'library', 'reason' Attribute to ssl.SSLError
2022-08-15 21:29:26 +09:00
Jeong YunWon
bffb40fec6 Fix fcntl.ioctl to take non-negative request 2022-08-15 02:36:46 +09:00
TaeGit
93d411d50a Add 'library', 'reason' Attribute to ssl.SSLError 2022-08-14 04:52:31 +09:00
Jeong YunWon
33ab9497a3 Fix clippy warnings 2022-08-12 11:45:33 +09:00
Jeong YunWon
dae8c31d3a Fix a2b_base64 invalid bytes handling 2022-08-09 04:08:26 +09:00
Jeong YunWon
7b643da3ea add ssl.SSLContext.post_handshake_auth 2022-08-07 16:31:38 +09:00
hyerim
42290b103e Add: _uuid module (#3974) 2022-08-07 15:27:53 +09:00
Jeong YunWon
8dad7add5b Merge pull request #3816 from chang-57/binascii_qp
Add `binascii` `a2b_qp`
2022-08-07 06:22:21 +09:00
Lee Dogeon
02e05e489d Correct binascii.unhexlify error type (#4005)
* Correct `binascii.unhexlify` error type

* Unmark resolved tests
2022-08-07 06:21:35 +09:00
Jeong YunWon
1f13d11cf3 Fix magic number horror 2022-08-07 05:57:43 +09:00
Jeong YunWon
a02558b63a fix bug and styles not fixed yet 2022-08-07 05:57:21 +09:00
hachangmin6
33110aecfe add binascii a2b_qp
Signed-off-by: hachangmin6 <tom5757tom@pusan.ac.kr>
2022-08-07 04:33:15 +09:00
Jeong YunWon
8a307b89dd Merge pull request #2444 from verhovsky/add-bz2
add bz2 from CPython 3.10.5
2022-08-05 05:08:20 +09:00
Jeong YunWon
da9c98675b optional bz2 2022-08-05 04:00:51 +09:00
boris
7204ab7ea8 implement _bz2
Co-Authored-By: Jeong YunWon <jeong@youknowone.org>
2022-08-05 03:53:59 +09:00
Jeong YunWon
c073a611a1 Merge pull request #3598 from hwi-ya/timeout
Modify timeout print message
2022-08-05 02:09:40 +09:00