Skip to content
Snippets Groups Projects
Select Git revision
  • 58a7da9e125422323f79c4ee95ac5549989d8162
  • main default protected
  • 3.10
  • 3.11
  • revert-15688-bpo-38031-_io-FileIO-opener-crash
  • 3.8
  • 3.9
  • 3.7
  • enum-fix_auto
  • branch-v3.11.0
  • backport-c3648f4-3.11
  • gh-93963/remove-importlib-resources-abcs
  • refactor-wait_for
  • shared-testcase
  • v3.12.0a2
  • v3.12.0a1
  • v3.11.0
  • v3.8.15
  • v3.9.15
  • v3.10.8
  • v3.7.15
  • v3.11.0rc2
  • v3.8.14
  • v3.9.14
  • v3.7.14
  • v3.10.7
  • v3.11.0rc1
  • v3.10.6
  • v3.11.0b5
  • v3.11.0b4
  • v3.10.5
  • v3.11.0b3
  • v3.11.0b2
  • v3.9.13
34 results

cpython

  • Clone with SSH
  • Clone with HTTPS
  • user avatar
    Robert Smallshire authored and GitHub committed
    * bpo-26680: Adds support for int.is_integer() for compatibility with float.is_integer().
    
    The int.is_integer() method always returns True.
    
    * bpo-26680: Adds a test to ensure that False.is_integer() and True.is_integer() are always True.
    
    * bpo-26680: Adds Real.is_integer() with a trivial implementation using conversion to int.
    
    This default implementation is intended to reduce the workload for subclass
    implementers. It is not robust in the presence of infinities or NaNs and
    may have suboptimal performance for other types.
    
    * bpo-26680: Adds Rational.is_integer which returns True if the denominator is one.
    
    This implementation assumes the Rational is represented in it's
    lowest form, as required by the class docstring.
    
    * bpo-26680: Adds Integral.is_integer which always returns True.
    
    * bpo-26680: Adds tests for Fraction.is_integer called as an instance method.
    
    The tests for the Rational abstract base class use an unbound
    method to sidestep the inability to directly instantiate Rational.
    These tests check that everything works correct as an instance method.
    
    * bpo-26680: Updates documentation for Real.is_integer and built-ins int and float.
    
    The call x.is_integer() is now listed in the table of operations
    which apply to all numeric types except complex, with a reference
    to the full documentation for Real.is_integer().  Mention of
    is_integer() has been removed from the section 'Additional Methods
    on Float'.
    
    The documentation for Real.is_integer() describes its purpose, and
    mentions that it should be overridden for performance reasons, or
    to handle special values like NaN.
    
    * bpo-26680: Adds Decimal.is_integer to the Python and C implementations.
    
    The C implementation of Decimal already implements and uses
    mpd_isinteger internally, we just expose the existing function to
    Python.
    
    The Python implementation uses internal conversion to integer
    using to_integral_value().
    
    In both cases, the corresponding context methods are also
    implemented.
    
    Tests and documentation are included.
    
    * bpo-26680: Updates the ACKS file.
    
    * bpo-26680: NEWS entries for int, the numeric ABCs and Decimal.
    
    Co-authored-by: default avatarRobert Smallshire <rob@sixty-north.com>
    58a7da9e
    History
    Name Last commit Last update