Skip to content

Commit dd06516

Browse files
crazymerlynyouknowone
authored andcommitted
Deprecate delegating int() to __trunc__
1 parent 8066f36 commit dd06516

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

Lib/test/test_long.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,6 @@ def test_long(self):
378378
self.assertRaises(ValueError, int, '\u3053\u3093\u306b\u3061\u306f')
379379

380380

381-
# TODO: RUSTPYTHON
382-
@unittest.expectedFailure
383381
def test_conversion(self):
384382

385383
class JustLong:

vm/src/protocol/number.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,12 @@ impl PyObject {
6363
} else if let Some(i) = self.to_number().int(vm).or_else(|| self.try_index_opt(vm)) {
6464
i
6565
} else if let Ok(Some(f)) = vm.get_special_method(self, identifier!(vm, __trunc__)) {
66-
// TODO: Deprecate in 3.11
67-
// warnings::warn(
68-
// vm.ctx.exceptions.deprecation_warning.clone(),
69-
// "The delegation of int() to __trunc__ is deprecated.".to_owned(),
70-
// 1,
71-
// vm,
72-
// )?;
66+
warnings::warn(
67+
vm.ctx.exceptions.deprecation_warning,
68+
"The delegation of int() to __trunc__ is deprecated.".to_owned(),
69+
1,
70+
vm,
71+
)?;
7372
let ret = f.invoke((), vm)?;
7473
ret.try_index(vm).map_err(|_| {
7574
vm.new_type_error(format!(

0 commit comments

Comments
 (0)