Title: builtins.round fails if passed a decimal · Issue #501 · PythonCharmers/python-future · GitHub
Open Graph Title: builtins.round fails if passed a decimal · Issue #501 · PythonCharmers/python-future
X Title: builtins.round fails if passed a decimal · Issue #501 · PythonCharmers/python-future
Description: >>> round(Decimal('0.5')) Traceback (most recent call last): File "
Open Graph Description: >>> round(Decimal('0.5')) Traceback (most recent call last): File "
X Description: >>> round(Decimal('0.5')) Traceback (most recent call last): File "<stdin>", line 1, in <module> File ".venv/lib/python2.7/site-packages/future/builtins/...
Opengraph URL: https://github.com/PythonCharmers/python-future/issues/501
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"builtins.round fails if passed a decimal","articleBody":"```\r\n\u003e\u003e\u003e round(Decimal('0.5'))\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n File \".venv/lib/python2.7/site-packages/future/builtins/newround.py\", line 42, in newround\r\n d = Decimal.from_float(number).quantize(exponent,\r\n File \"/Users/tpict/.asdf/installs/python/2.7.16/lib/python2.7/decimal.py\", line 690, in from_float\r\n n, d = abs(f).as_integer_ratio()\r\nAttributeError: 'Decimal' object has no attribute 'as_integer_ratio'\r\n```\r\nThe `newround` function doesn't check if the input is of type `Decimal` before trying to convert it to one.","author":{"url":"https://github.com/tpict","@type":"Person","name":"tpict"},"datePublished":"2019-09-20T19:14:25.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/501/python-future/issues/501"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9295715c-cf0e-cf7c-b080-5e32345ce7fa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA62:1E0146:8A6D5C:B92991:69697B4F |
| html-safe-nonce | 918e9d9e5780b2d18f73e4801b2493d087084b79d163b1acdc52123ef59eb149 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTYyOjFFMDE0Njo4QTZENUM6QjkyOTkxOjY5Njk3QjRGIiwidmlzaXRvcl9pZCI6Ijg0OTgxNzgzNTEyNzA4MjA2ODciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a8bccad1c46993191a413eadf6309533fd1cd4a22f9a80b05c58735fbd5cf92d |
| hovercard-subject-tag | issue:496506539 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PythonCharmers/python-future/501/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fdfa064dd60e06a54c8545fbc77d76bd4ce8cb1bffd5fd341a5306b8f8c34fb7/PythonCharmers/python-future/issues/501 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fdfa064dd60e06a54c8545fbc77d76bd4ce8cb1bffd5fd341a5306b8f8c34fb7/PythonCharmers/python-future/issues/501 |
| og:image:alt | >>> round(Decimal('0.5')) Traceback (most recent call last): File " |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tpict |
| hostname | github.com |
| expected-hostname | github.com |
| None | f33e4b94c8824ab2b434d82a94139432fb5ebee9df4b75304140ad22508c4a77 |
| turbo-cache-control | no-preview |
| go-import | github.com/PythonCharmers/python-future git https://github.com/PythonCharmers/python-future.git |
| octolytics-dimension-user_id | 3365815 |
| octolytics-dimension-user_login | PythonCharmers |
| octolytics-dimension-repository_id | 11403699 |
| octolytics-dimension-repository_nwo | PythonCharmers/python-future |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 11403699 |
| octolytics-dimension-repository_network_root_nwo | PythonCharmers/python-future |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 48f380098b30acbb700b04f1724481ca10d574fc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width