Commit Graph
664 Commits
Author SHA1 Message Date
Jeong, YunWon d8a4a09ec0 Fix #[pyclass(base=...)] notation (#6242) 2025-11-10 09:47:57 +09:00
Jeong, YunWon 614028f9a8 more ssl impl (#6228) 2025-10-29 23:01:04 +09:00
Jeong, YunWon 2acc3be6cf More SSL impl (#6224)
* fix ipv6 formattig

* consts

* fspath

* fix set_ecdh_curve

* minimum/maximum version

* Add SSL_CTX_security_level
2025-10-28 12:00:44 +09:00
Jeong, YunWon 9a2792a44b PySSLCertificate (#6219) 2025-10-27 22:31:59 +09:00
Jeong YunWon 517b55b8b5 pyssl errors 2025-10-27 18:37:01 +09:00
Jeong, YunWon 2e7a8b4735 Implement more SSL methods (#6210)
* openssl-sys version

* selected_alpn_protocol

* get_ciphers

* get_channel_binding

* Add Tls1_1 and Tls1_2

* consts

* fix ssl truncate bug

* verify_flags

* shared ciphers

* verify_client_post_handshake

* shutdown

* get_verified_chain

* fix lints

* fix _wrap_socket

* Fix convert_openssl_error

* clean up ssl

* X509_check_ca

* set default verify flag

* Fix version

* fix import

* consts

* fix httplib
2025-10-26 19:19:24 +09:00
Yash SutharandJeong, YunWon c6c931aa0b Fix ldexp to prevent math range errors (#6216)
* Fix ldexp to prevent math range errors

Implemented IEEE 754-compliant handling for large numbers to avoid
overflow and represent results using scientific notation.

Fixes #5471

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

* Fix ldexp to handle denormalized inputs correctly

Detect denormalized input values below f64::MIN_POSITIVE
Scale subnormal inputs by 2^54 to bring them into normalized range

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

* tests(math): remove expectedFailure from testLdexp_denormal

As now we have implemented IEEE 754 format , so this will pass.

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

* Update Lib/test/test_math.py

Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>

* fixed formate in math.rs

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>

---------

Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2025-10-26 17:33:49 +09:00
Jeong, YunWon 3ec905e08a ssl.{SSLSession,MemoryBIO} (#6209)
* SSLSession

* get_unverified_chain

* SSL MemoryBIO
2025-10-23 18:37:40 +09:00
Jiseok CHOI 2faa05dcfb Fix sqlite Connection initialization check (#6199)
* Fix sqlite3 Connection initialization check

Add proper __init__ validation for sqlite3.Connection to ensure base class
__init__ is called before using connection methods. This fixes the
test_connection_constructor_call_check test case.

Changes:
- Modified Connection.py_new to detect subclassing
- For base Connection class, initialization happens immediately in py_new
- For subclassed Connection, db is initialized as None
- Added __init__ method that performs actual database initialization
- Updated _db_lock error message to match CPython: 'Base Connection.__init__ not called.'

This ensures CPython compatibility where attempting to use a Connection
subclass instance without calling the base __init__ raises ProgrammingError.

* use Initializer trait
2025-10-21 11:11:31 +09:00
Jiseok CHOI 25a464eeae Fix sqlite3 Cursor initialization check (#6198)
Add proper __init__ validation for sqlite3.Cursor to ensure base class
__init__ is called before using cursor methods. This fixes the
test_cursor_constructor_call_check test case.

Changes:
- Modified Cursor to initialize with inner=None in py_new
- Added explicit __init__ method that sets up CursorInner
- Updated close() method to check for uninitialized state
- Changed error message to match CPython: 'Base Cursor.__init__ not called.'

This ensures CPython compatibility where attempting to use a Cursor
instance without calling the base __init__ raises ProgrammingError.
2025-10-21 09:33:55 +09:00
Shahar NavehandNoa fcf196935e Update ruff 0.14.1 (#6195)
* Update ruff to 0.14.1

* Fix test regression in `test_compile`

* Unmark passing test

* Update `test_syntax` from 3.13.9

---------

Co-authored-by: Noa <coolreader18@gmail.com>
2025-10-20 22:46:46 +09:00
Shahar Naveh 3a6fda4daf Update opcode from 3.13.7 (#6156)
* Update `opcode` from 3.13.7

* Base `_opcode`

* Add `test__opcode.py` from 3.13.7

* Impl `has_*` methods

* Add more methods

* Update `dis.py` from 3.13.7

* Update `support/bytecode_helper.py` from 3.13.7

* correct is_valid

* Patch failing tests

* Unpatch `support/__init__.py`

* clippy

* Make comments to doc

* impl `_varname_from_oparg` for code

* Unmark passing tests

* Revert changes to `dis`

* Mark failing tests
2025-10-05 11:14:33 +09:00
Shahar Naveh 141ed72693 Dependencies cleanup (#6151)
* Update deps

* Remove some unused deps

* Update lockfile
2025-09-17 09:10:35 +09:00
Shahar Naveh 62067aefd3 Update uuid from 3.13.7 (#6155) 2025-09-16 21:58:36 +09:00
Noa 85ca28094e Apply clippy suggestions to switch to let chains (#6126) 2025-09-04 15:34:10 +09:00
Noa 0c8ae3a384 Update nix to 0.30 (#6120) 2025-09-04 08:44:27 +09:00
Noa cca4fe6d80 Switch to newer thread::LocalKey convenience methods (#6123) 2025-09-03 22:14:59 +09:00
Noa fa91df6539 Merge pull request #6118 from ever0de/feat/sqlite-fetchmany-size-arg
sqlite3: Support 'size' keyword argument in `Cursor::fetchmany`
2025-09-01 14:17:35 -05:00
ShaharNaveh 1fe5fd55d3 Update xml(-rs) to 1.0 2025-09-01 14:01:03 +03:00
ShaharNaveh 711f95ec09 Update dns-lookup to 3.0 2025-09-01 13:59:16 +03:00
Jiseok CHOI 2e16f51c68 use FromArgs 2025-09-01 15:43:07 +09:00
Jiseok CHOI a2b194a6f8 sqlite3: Support 'size' keyword argument in Cursor::fetchmany 2025-09-01 15:23:04 +09:00
ShaharNaveh d28164c150 Update test_ucn.py from 3.13.7 2025-08-24 00:17:50 +03:00
Jiseok CHOI e909e32f31 sqlite: Fix missing ProgrammingError for parameter mismatch (#6104) 2025-08-21 13:19:38 +09:00
Shahar Naveh 9417e1023d Update xml from 3.13.7 (#6100) 2025-08-21 13:15:39 +09:00
Jeong, YunWon bfc513e997 Fix future clippy warnings (#6103) 2025-08-20 17:34:29 +09:00
Shahar Naveh 242814fa72 Update locale.py from 3.13.6 and made _locale available on android (#6091) 2025-08-20 13:44:57 +09:00
Jeong, YunWon 158c027c23 Rust 1.89 clippy fix (#6082) 2025-08-08 15:00:18 +09:00
Shahar Naveh cac4948afe Update rustyline & socket2 (#6074)
* Update rustyline to 17.0.0

* Update dns-lookup and socket2

* run `cargo update`
2025-08-06 10:31:21 +09:00
Jack O'Connor b480d234dd Reorder struct lconv members to match locale.h (#6073)
`struct lconv` in locale.h
https://codebrowser.dev/glibc/glibc/locale/locale.h.html#lconv::int_p_cs_precedes.

Order of relevant section in glibc locale.h
```C
char int_p_cs_precedes;
char int_p_sep_by_space;
char int_n_cs_precedes;
char int_n_sep_by_space;
```
2025-08-06 10:30:23 +09:00
Jiseok CHOI a58d582001 Implement unsupported ops for sqlite3.Blob (#6066) 2025-08-05 17:53:06 +09:00
Shahar Naveh 2d65c7f859 Update some deps (#6053) 2025-08-01 22:14:56 +09:00
Jiseok CHOI ec0a2325e4 Use Unconstructible trait for internal types 2025-08-01 18:04:15 +09:00
Jiseok CHOI b2d6594bd9 Prevent direct instantiation of sqlite3.{Statement,Blob} 2025-08-01 13:39:45 +09:00
Jiseok CHOI 1e6da5f430 sqlite: Align Connection.__call__ error handling with CPython (#6042) 2025-07-30 14:05:17 +09:00
Jeong, YunWon cee579e7ea Merge pull request #6047 from youknowone/wtf8 2025-07-30 12:45:03 +09:00
Shahar Naveh 4bf32a04f4 Apply some clipy lints (#6045) 2025-07-30 12:16:02 +09:00
Jeong YunWon d46c882347 remove try_to_str
Rewrite sqlite3 UTF8 validation
2025-07-30 12:14:47 +09:00
Jiseok CHOI d8f1d188c3 stdlib(sqlite): Raise ProgrammingError in closed Blob context manager (#6041) 2025-07-27 21:47:05 +09:00
Jiseok CHOI 38ca076cb5 feat(stdlib/sqlite): Implement slice assignment for Blob (#6039) 2025-07-27 10:43:11 +09:00
Jack O'Connor 4079776c36 Add kde function and tests to RustPython statistics module (#6030)
* Copy CPython 3.13 statistics module into RustPython

* Adjust CPython "magic constants" in KDE tests

## test_kde

I'm not too sure why but this one takes a few seconds to run the second
for loop which calculates the cumulative distribution and does a rough
calculation of the area under the curve.

## test_kde_random

I have a lower bound for RustPython to sort a random list of 1_000_000
numbers on my laptop of > 1 hour. By dropping n to 30_000 sort will not
take an egregious amount of time to run. It is then necessary to lower
the tolerance for the math.isclose check, or the computed values may
**randomly** fail due to the higher variance caused by the smaller
sample size.

* Reintroduce expected failure in test_statistics.TestNormalDict.test_slots

* Sync Rust `normal_dist_inv_cdf` with Python equivalent

See https://github.com/python/cpython/pull/95265.

To quote:
> Restores alignment with random.gauss(mu, sigma) and
random.normalvariate(mu, sigma) both. of which are equivalent to
sampling from NormalDist(mu, sigma).inv_cdf(random()). The two functions
in the random module happy accept sigma=0 and give a well-defined
result.

> This also lets the function gently handle a sigma getting smaller,
eventually becoming zero. As sigma decrease, NormalDist(mu,
sigma).inv_cdf(p) forms a tighter and tighter internal around mu and
becoming exactly mu in the limit. For example, NormalDist(100,
1E-300).inv_cdf(0.3) cleanly evaluates to 100.0but withsigma=1e-500``
the function previously would raised an unexpected error.
2025-07-26 00:42:22 +09:00
Shahar Naveh c232b7f1f8 Update csv.py from 3.13.5 (#6035)
* Use `raise_if_stop!` macro

* Update `csv.py` from 3.13.5

* Mark failing tests
2025-07-25 19:08:01 +09:00
Jiseok CHOI fb9147736d stdlib(sqlite3): Raise ProgrammingError for missing named parameter (#6036) 2025-07-25 19:02:56 +09:00
Shahar Naveh 01edb93957 Resolve libc::RLIM_NLIMITS warning on android (#6025)
* Resolve warning on android

* Apply CodeRabbit suggestion
2025-07-25 10:46:32 +09:00
Jiseok CHOI bcf56279ec Raise UnicodeEncodeError for surrogates in sqlite.executescript (#6024) 2025-07-25 10:45:33 +09:00
Jiseok CHOI 57bdf35ee6 Enforce valid UTF-8 encoding for sqlite collation names (#6015)
* Make public `PyStr::ensure_valid_utf8`

* Enforce valid UTF-8 encoding for sqlite collation names
2025-07-21 23:42:47 +09:00
Jiseok CHOI bbe98ddd86 Construct detailed message on text decode failure (#6014) 2025-07-21 22:33:09 +09:00
Jiseok CHOI 6f80ac0edd Align SQL comment parsing with CPython (#5996) 2025-07-20 10:51:42 +09:00
Jiseok CHOI f8d03fd680 Correctly implement isolation_level setter to handle deletion (#5983) 2025-07-18 23:08:51 +09:00
Jeong, YunWon 6a3dff63bb Downcastable (#5986)
* simplify int power

* downcastasble

* deprecate payload*
2025-07-16 18:00:18 +09:00