GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BLD: clean up incorrect-but-hardcoded define for `strtold_l` check. by rgommers · Pull Request #24979 · numpy/numpy

Conversation

@rgommers

@rgommers rgommers commented Oct 21, 2023

Copy link
Copy Markdown
Member

Related to gh-24968, which touched this check because it was incorrect for MinGW-w64.

strtold_l is GNU-specific and missing on many platforms, see https://www.gnu.org/software///gnulib/manual/html_node/strtold_005fl.html.

If it does go missing, the only problem seems to be some minor changes in long double printing code, failing two tests:

 ______________________________ test_str_roundtrip ______________________________

      @pytest.mark.skipif(IS_MUSL,
                          reason="test flaky on musllinux")
      @pytest.mark.skipif(LD_INFO.precision + 2 >= repr_precision,
                          reason="repr precision not enough to show eps")
      def test_str_roundtrip():
          # We will only see eps in repr if within printing precision.
          o = 1 + LD_INFO.eps
  >       assert_equal(np.longdouble(str(o)), o, "str was %s" % str(o))
  E       AssertionError:
  E       Items are not equal: str was 1.0000000000000000001
  E        ACTUAL: np.longdouble('1.0')
  E        DESIRED: np.longdouble('1.0000000000000000001')

  o          = np.longdouble('1.0000000000000000001')

  numpy/_core/tests/test_longdouble.py:43: AssertionError
  ____________________ TestRealScalars.test_dragon4_interface ____________________

  self = <numpy._core.tests.test_scalarprint.TestRealScalars object at 0x7f5804791df0>

      def test_dragon4_interface(self):
          tps = [np.float16, np.float32, np.float64]
          # test is flaky for musllinux on np.float128
          if hasattr(np, 'float128') and not IS_MUSL:
              tps.append(np.float128)

          fpos = np.format_float_positional
          fsci = np.format_float_scientific

          for tp in tps:
              # test padding
              assert_equal(fpos(tp('1.0'), pad_left=4, pad_right=4), "   1.    ")
              assert_equal(fpos(tp('-1.0'), pad_left=4, pad_right=4), "  -1.    ")
  >           assert_equal(fpos(tp('-10.2'),
                           pad_left=4, pad_right=4), " -10.2   ")
  E           AssertionError:
  E           Items are not equal:
  E            ACTUAL: ' -10.1999999999999992895'
  E            DESIRED: ' -10.2   '

  fpos       = <function format_float_positional at 0x7f580b047700>
  fsci       = <function format_float_scientific at 0x7f580b047670>
  self       = <numpy._core.tests.test_scalarprint.TestRealScalars object at 0x7f5804791df0>
  tp         = <class 'numpy.longdouble'>
  tps        = [<class 'numpy.float16'>, <class 'numpy.float32'>, <class 'numpy.float64'>, <class 'numpy.longdouble'>]

  numpy/_core/tests/test_scalarprint.py:276: AssertionError
  =========================== short test summary info ============================
  FAILED numpy/_core/tests/test_longdouble.py::test_str_roundtrip - AssertionError:
  Items are not equal: str was 1.0000000000000000001
   ACTUAL: np.longdouble('1.0')
   DESIRED: np.longdouble('1.0000000000000000001')
  FAILED numpy/_core/tests/test_scalarprint.py::TestRealScalars::test_dragon4_interface - AssertionError:
  Items are not equal:
   ACTUAL: ' -10.1999999999999992895'
   DESIRED: ' -10.2   '

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rgommers rgommers added 36 - Build Build related PR Meson Items related to the introduction of Meson as the new build system for NumPy labels Oct 21, 2023
@rgommers
BLD: clean up incorrect-but-hardcoded define for strtold_l check.
9f1dd22
GNU-specific and missing on many platforms, see
https://www.gnu.org/software///gnulib/manual/html_node/strtold_005fl.html

If it does go missing, the only problem seems to be some minor changes
in long double printing code, failing two tests:

```
 ______________________________ test_str_roundtrip ______________________________

      @pytest.mark.skipif(IS_MUSL,
                          reason="test flaky on musllinux")
      @pytest.mark.skipif(LD_INFO.precision + 2 >= repr_precision,
                          reason="repr precision not enough to show eps")
      def test_str_roundtrip():
          # We will only see eps in repr if within printing precision.
          o = 1 + LD_INFO.eps
  >       assert_equal(np.longdouble(str(o)), o, "str was %s" % str(o))
  E       AssertionError:
  E       Items are not equal: str was 1.0000000000000000001
  E        ACTUAL: np.longdouble('1.0')
  E        DESIRED: np.longdouble('1.0000000000000000001')

  o          = np.longdouble('1.0000000000000000001')

  numpy/_core/tests/test_longdouble.py:43: AssertionError
  ____________________ TestRealScalars.test_dragon4_interface ____________________

  self = <numpy._core.tests.test_scalarprint.TestRealScalars object at 0x7f5804791df0>

      def test_dragon4_interface(self):
          tps = [np.float16, np.float32, np.float64]
          # test is flaky for musllinux on np.float128
          if hasattr(np, 'float128') and not IS_MUSL:
              tps.append(np.float128)

          fpos = np.format_float_positional
          fsci = np.format_float_scientific

          for tp in tps:
              # test padding
              assert_equal(fpos(tp('1.0'), pad_left=4, pad_right=4), "   1.    ")
              assert_equal(fpos(tp('-1.0'), pad_left=4, pad_right=4), "  -1.    ")
  >           assert_equal(fpos(tp('-10.2'),
                           pad_left=4, pad_right=4), " -10.2   ")
  E           AssertionError:
  E           Items are not equal:
  E            ACTUAL: ' -10.1999999999999992895'
  E            DESIRED: ' -10.2   '

  fpos       = <function format_float_positional at 0x7f580b047700>
  fsci       = <function format_float_scientific at 0x7f580b047670>
  self       = <numpy._core.tests.test_scalarprint.TestRealScalars object at 0x7f5804791df0>
  tp         = <class 'numpy.longdouble'>
  tps        = [<class 'numpy.float16'>, <class 'numpy.float32'>, <class 'numpy.float64'>, <class 'numpy.longdouble'>]

  numpy/_core/tests/test_scalarprint.py:276: AssertionError
  =========================== short test summary info ============================
  FAILED numpy/_core/tests/test_longdouble.py::test_str_roundtrip - AssertionError:
  Items are not equal: str was 1.0000000000000000001
   ACTUAL: np.longdouble('1.0')
   DESIRED: np.longdouble('1.0000000000000000001')
  FAILED numpy/_core/tests/test_scalarprint.py::TestRealScalars::test_dragon4_interface - AssertionError:
  Items are not equal:
   ACTUAL: ' -10.1999999999999992895'
   DESIRED: ' -10.2   '
```

put GNU-source above locale.h

fix issue in numpyos.c
@rgommers
rgommers force-pushed the fix-strtold_l-check branch from c021262 to 9f1dd22 Compare October 21, 2023 19:42
@rgommers rgommers mentioned this pull request Oct 21, 2023
BLD: mingw-w64 build fixes #24968
Merged
@charris
charris merged commit d03d4ed into numpy:main Oct 24, 2023
@charris

charris commented Oct 24, 2023

Copy link
Copy Markdown
Member

Let's give it a shot. Thanks Ralf.

rgommers reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers
rgommers deleted the fix-strtold_l-check branch October 24, 2023 15:53
@rgommers rgommers added this to the 2.0.0 release milestone Oct 24, 2023
@rgommers rgommers mentioned this pull request Nov 1, 2023
OpenBSD/amd64 7.4 undefined symbol 'strtold_l' during the import #25047
Closed
@rgommers rgommers added the 09 - Backport-Candidate PRs tagged should be backported label Nov 1, 2023
@charris charris mentioned this pull request Nov 1, 2023
MAINT: Update meson build infrastructure. #25049
Merged
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Nov 6, 2023
charris added a commit that referenced this pull request Nov 6, 2023
@charris @mattip
MAINT: Update meson build infrastructure. (#25049)
df93b11
Backports of #24969, #24979, #24968, #25068.

* apply 24969.diff

* apply 24979.diff

* apply 24968.diff

* TST: skip flaky test in test_histogram

---------

Co-authored-by: mattip <[email protected]>
charris added a commit to charris/numpy that referenced this pull request Nov 11, 2023
@charris @mattip
MAINT: Update meson build infrastructure. (numpy#25049)
6b55dd8
Backports of numpy#24969, numpy#24979, numpy#24968, numpy#25068.

* apply 24969.diff

* apply 24979.diff

* apply 24968.diff

* TST: skip flaky test in test_histogram

---------

Co-authored-by: mattip <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

36 - Build Build related PR Meson Items related to the introduction of Meson as the new build system for NumPy

Projects

None yet

Milestone

2.0.0 release

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@rgommers @charris
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.