Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-29534: _decimal difference with _pydecimal #65

Merged
merged 1 commit into from
Feb 14, 2017
Merged

bpo-29534: _decimal difference with _pydecimal #65

merged 1 commit into from
Feb 14, 2017

Conversation

andrewnester
Copy link
Contributor

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA. This is necessary for legal reasons before we can look at your contribution. Please follow these steps to help rectify the issue:

  1. If you don't have an account on b.p.o, please create one
  2. Make sure your GitHub username is listed in "Your Details" at b.p.o
  3. If you have not already done so, please sign the PSF contributor agreement
  4. If you just signed the CLA, please wait at least a day and then check "Your Details" on bugs.python.org to see if your account has been marked as having signed the CLA (the delay is due to a person having to manually check your signed CLA)
  5. Reply here saying you have completed the above steps

Thanks again to your contribution and we look forward to looking at it!

@berkerpeksag berkerpeksag changed the title Fixed #29534 - _decimal difference with _pydecimal bpo-29534: _decimal difference with _pydecimal Feb 13, 2017
@skrah skrah removed their request for review February 13, 2017 12:08
@mdickinson
Copy link
Member

The new behaviour seems like the right thing to me. Can you rework the code to avoid the repetition of the if cls is Decimal block?

@andrewnester
Copy link
Contributor Author

@mdickinson thanks for the comment! I've just reworked my PR to avoid code duplication.

Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes mostly LGTM, modulo a couple of nitpicks.

Still needs:

  • contributor agreement for Andrew
  • Misc/NEWS entry

return cls(repr(f))
if _math.copysign(1.0, f) == 1.0:
sign = 0
sign = 0 if f >=0 else 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: please add a space after the >=.

@@ -5467,6 +5477,7 @@ def __abs__(self):
self.assertEqual(Decimal.from_float(cls(101.1)),
Decimal.from_float(101.1))


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems unrelated to the PR; please could you revert it?

@@ -1185,6 +1185,16 @@ def test_wide_char_separator_decimal_point(self):
self.assertEqual(format(Decimal('100000000.123'), 'n'),
'100\u066c000\u066c000\u066b123')

def test_decimal_from_float_repr(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just nitpicking, but I think we're testing the wrong thing here: the change is in the type of the object that's passed to the Decimal subclass; the repr of the value was just a convenient way of demonstrating the difference in behaviours between the Python and C decimal implementations. How about recording and checking the type instead of the repr?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdickinson good idea, thanks!

@andrewnester
Copy link
Contributor Author

andrewnester commented Feb 13, 2017

@mdickinson thanks! I've fixed all the nitpickings you mentioned. Also updated NEWS.

@mdickinson
Copy link
Member

@andrewnester: Thank you! One last nitpick: please could you change the name of the test?

Apart from that, this looks good to go. Did you fill out the CLA?

@andrewnester
Copy link
Contributor Author

@mdickinson fixed. yes, I filled it couple of hours ago :)

@mdickinson
Copy link
Member

In, that case, LGTM unconditionally.

Copy link
Member

@mdickinson mdickinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov
Copy link

codecov bot commented Feb 13, 2017

Codecov Report

Merging #65 into master will decrease coverage by -0.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master      #65      +/-   ##
==========================================
- Coverage   82.37%   82.37%   -0.01%     
==========================================
  Files        1427     1427              
  Lines      350948   350959      +11     
==========================================
+ Hits       289095   289100       +5     
- Misses      61853    61859       +6

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3cdbd68...c030ca7. Read the comment docs.

@mdickinson
Copy link
Member

The coverage gods seem a bit peeved, but I can't make head or tail of the coverage report. Which 6 lines are new misses? (And which 5 lines are new hits?)

@mdickinson mdickinson merged commit 6d1dece into python:master Feb 14, 2017
@mdickinson
Copy link
Member

Merged. Thanks for the contribution!

jaraco pushed a commit that referenced this pull request Dec 2, 2022
oraluben pushed a commit to oraluben/cpython that referenced this pull request Jul 14, 2023
* refactor: return BB metadata from BB creation function

* feat: add execute jitted code in BB_BRANCH

* nit: disable JIT debug

* nit: Removed debugging comment in ceval_macros.h

* nit: Removed indirection warning in jit.py

---------

Co-authored-by: Jules <julia.poo.poo.poo@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants