#28456 closed enhancement (fixed)

py3: fix gapdir fallback

Reported by: arojas Owned by:
Priority: major Milestone: sage-8.9
Component: python3 Keywords:
Cc: chapoton, jhpalmieri Merged in:
Authors: Antonio Rojas Reviewers: John Palmieri
Report Upstream: N/A Work issues:
Branch: 350a84e (Commits, GitHub, GitLab) Commit: 350a84ef15c000bd39240c19dedeefcd3e0b66e3
Dependencies: Stopgaps:

Status badges

Description (last modified by arojas)

Fix TypeError: 'filter' object is not subscriptable when GAP_ROOT_DIR doesn't exist.

On sage-the-distro GAP_ROOT_DIR points to an existing dir, so this code path is not being doctested.

Change History (7)

comment:1 Changed 23 months ago by arojas

  • Branch set to u/arojas/py3__fix_gapdir_fallback

comment:2 Changed 23 months ago by arojas

  • Authors set to Antonio Rojas
  • Cc chapoton jhpalmieri added
  • Commit set to 486111d01106f2e45cdb90a4f7a7aa8212ae9411
  • Component changed from PLEASE CHANGE to python3
  • Status changed from new to needs_review
  • Type changed from PLEASE CHANGE to enhancement

Fix TypeError: 'filter' object is not subscriptable when GAP_ROOT_DIR doesn't exist.

On sage-the-distro GAP_ROOT_DIR points to an existing dir, so this code path is not being doctested.


New commits:

486111dFix gapdir fallback on python 3

comment:3 Changed 23 months ago by jhpalmieri

Why not get rid of the filter command altogether? Use

[x for x in gap_sh if x.strip().startswith('GAP_ROOT')][0]

instead? Or this should be faster since we can stop after the first match:

next(x for x in gap_sh if x.strip().startswith('GAP_ROOT'))

(taken from https://stackoverflow.com/questions/2361426/get-the-first-item-from-an-iterable-that-matches-a-condition)

comment:4 Changed 23 months ago by git

  • Commit changed from 486111d01106f2e45cdb90a4f7a7aa8212ae9411 to 350a84ef15c000bd39240c19dedeefcd3e0b66e3

Branch pushed to git repo; I updated commit sha1. New commits:

350a84eUse next

comment:5 Changed 23 months ago by jhpalmieri

  • Reviewers set to John Palmieri
  • Status changed from needs_review to positive_review

This looks good to me.

comment:6 Changed 23 months ago by arojas

  • Description modified (diff)

comment:7 Changed 23 months ago by vbraun

  • Branch changed from u/arojas/py3__fix_gapdir_fallback to 350a84ef15c000bd39240c19dedeefcd3e0b66e3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.